I encountered this problem again today. I searched and sorted it out. There are three ways to solve the problem in the West:
Protected void button#click (Object sender, eventargs E)
{
1. response. Write ("<script language = JavaScript>/r alert (/" modification failed! /");/R </SCRIPT> ");
2. scriptmanager. registerstartupscript (updatepanel1, typeof (updatepanel), "alert", "alert ('Hello! '); ", True );
3. Page. registerstartupscript ("alert", "<script language = 'javascript '> window. showmodelessdialog (/" javascript: Alert ('Hello! ');/",/"/",/" Status: No; resizable: No; help: No; dialogheight: Height: 30px; dialogheight: 40px ;/") </SCRIPT> ");
4. // clientscript. registerclientscriptblock (typeof (updatepanel), "alert", "<SCRIPT> alert ('Do it yourself! ') </SCRIPT> ", true );
}
Front-end Page code;
<Form ID = "form1" runat = "server">
<Div>
<Div>
<Asp: scriptmanager id = "scriptmanager1" runat = "server">
</ASP: scriptmanager>
</Div>
<Asp: updatepanel id = "updatepanel1" runat = "server">
<Triggers>
<Asp: postbacktrigger controlid = "button1"/>
</Triggers>
<Contenttemplate>
<Asp: button id = "button1" runat = "server" text = "button" onclick = "button#click"> </ASP: button>
</Contenttemplate>
</ASP: updatepanel>
</Div>
</Form>
<Triggers>
<Asp: postbacktrigger controlid = "button1"/>
</Triggers>
You do not need to add the following types.
However, I have observed that the first type is Refresh, and the second and third types are not flushed. The fourth type does not seem to be able to respond, but the Internet says yes, I don't know...