- Add the following Namespace.
- using Microsoft.SharePoint.Utilities;
- using Microsoft.SharePoint.Utilities;
- Replace the code for btnSuccess_Click event with the following
SPUtility.TransferToSuccessPage("Operation Completed Successfully");
- Replace the code for btnError_Click event with the following
or
Exception ex = new Exception("Operation Failed - Contact to Your Administrator.");
SPUtility.TransferToErrorPage(ex.Message);
- Build and deploy the solution.