SharePoint pop-up message box

Source: Internet
Author: User

How does one pop up a box similar to MessageBox. Show in winform in event aggreger?

So how can I display some error messages or prompt messages to users?

 

1.

Httpcontext can be used for itemadding or other ongoing (ing) events. current. response. write ("<SCRIPT> alert ('aaa'); </SCRIPT> ");

If it is in itemadded or another post-end (ed) event, no action is taken. Because such events are asynchronous, The httpresponse of the page cannot be obtained.

 

2.

You can control the redirection error page in event reciver.
Http://www.c-sharpcorner.com/Blogs/4224/sharepoint-2010-event-handler-redirection-to-custom-error-pa.aspx

Properties. Status = speventrecieverstatus. cancelwithredirecturl;
Properties. redirecturl = "/_ layouts/myblog/customerror. aspx"

 

Public override void itemadding (spitemeventproperties properties)

{

Base. itemadding (properties );

String tITe = properties. afterproperties ["title"]. tostring ();

If (tITe. Contains ("_")

{

Properties. Cancel = true;

Properties. Status = speventrecieverstatus. cancelwithredirecturl;

Properties. redirecturl = "/_ layouts/myblog/customerror. aspx? Errormessage = inavlid

Title ";

}

 

}

 

3.

Create a application page called customerror. aspx and show the error message from the query string

 

 <asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="Server">   <asp:Label ID="lblError" runat="server" > </asp:Label></asp:Content>

4.

Add the following code in the page Load

 

protected void Page_Load(object sender EventArgs e)

{

      lblError.Text = Request.Param[“Error”];

}

 

5.

Function openanswerqandadialog (){
VaR Options = {
URL: "/_ layouts/qanda_personalanswer.aspx ",
Width: 600,
Height: 480,
Title: "personal qanda"
};
Sp. UI. modaldialog. showmodaldialog (options );
}
Use js to call this function. This is a function provided by Sharepoint. Please reference the SharePoint naming control in webpart.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.