SIGN UP MEMBER LOGIN:    
ARTICLE

How to redirect to the SharePoint Success or Error Message page

Posted by Vijai Anand Articles | SharePoint March 16, 2011
In this article we will be seeing how to redirect to the SharePoint Success or Error message page.
Reader Level:

In this article we will be seeing how to redirect to the SharePoint Success or Error message page.

In this article I will be creating a visual web part with two buttons - Success and Error button.

On click event of Success button, it will be redirected to the SharePoint Success page.

On click event of Error button, it will be redirected to the SharePoint Error page.

Steps Involved:

  • Open Visual Studio 2010.
  • Create a Visual Web part.
  • Add two buttons Success and Error.
  • Add the following Namespace.
     
    • 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

    Exception ex = new Exception("Operation Failed");
    SPUtility.TransferToErrorPage(ex.Message);
     
  • Build and deploy the solution.
  • Add the web part in the SharePoint site.

    share1.gif
     
  • On click of Success button it will be redirected to the following page

    share2.gif
     
  • On click of Error button it will be redirected to the following page

    share3.gif

 

Login to add your contents and source code to this article
share this article :
post comment
 
Team Foundation Server Hosting
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor