Asp.net pop-up information box-use scriptmanager

Source: Internet
Author: User

 

I,

Front-end code:

<Div>
<Asp: scriptmanager id = "scriptmanager1" runat = "server">
</ASP: scriptmanager>
<Asp: updatepanel id = "updatepanel1" runat = "server">
<Contenttemplate>

</Contenttemplate>
<Triggers>
<Asp: asyncpostbacktrigger controlid = "button1" eventname = "click"/>
<Asp: asyncpostbacktrigger controlid = "button2" eventname = "click"/>
</Triggers>
</ASP: updatepanel>

<Asp: button id = "button1" runat = "server" text = "pop-up confirmation message" onclick = "button#click"/>
& Nbsp; <asp: button id = "button2" runat = "server" text = "pop-up select row information"
Onclick = "button2_click"/>
& Nbsp;
<Asp: Label id = "label1" runat = "server"> </ASP: Label>
</Div>

Background code:

Protected void button#click (Object sender, eventargs E)
{
Scriptmanager. registerstartupscript (updatepanel1, updatepanel1.gettype (), "", "alert ('OK! ') ", True );
}

Method 2:

Front-end code:

<Div>
<Asp: scriptmanager id = "SM" runat = "server">
</ASP: scriptmanager>
<Asp: updatepanel id = "up" runat = "server">
<Contenttemplate>
<Asp: button id = "btncommit" runat = "server" text = "button"
Onclick = "btncommit_click"/>
& Nbsp;
<Asp: Label id = "label1" runat = "server" text = "label"> </ASP: Label>
</Contenttemplate>
</ASP: updatepanel>
</Div>

Background code:

Protected void btncommit_click (Object sender, eventargs E)
{
/// Obtain the button in the pop-up dialog box
Button button = (button) sender;
/// Script of the registration dialog box
Scriptmanager. registerclientscriptblock (button, button. GetType (), button. uniqueid, "alert ('This is a dialog box in the Ajax Web environment. '); ", True );

}

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.