1. How to bring up prompt information in the background
Response. Write ("<scripttype =" text/JavaScript "> alert ('the data you queried does not exist! '); </SCRIPT> ");
// The prompt is displayed, but the page is blank.
Page. registerclientscriptblock ("tishi", "<scripttype =" text/JavaScript "> alert ('data You queried does not exist'); </SCRIPT> ");
// The prompt is displayed, but the page is blank.
Page. registerstartupscript ("tishi", "<scripttype =" text/JavaScript "> alert ('data You queried does not exist'); </SCRIPT>"); // expired,
// The prompt message is displayed. The page is not blank.
Clientscript. registerclientscriptblock (this. GetType (), "tishi", "<SCRIPT type =" text/JavaScript "> alert ('the data you queried does not exist! '); </SCRIPT> ");
// The prompt is displayed, but the page is blank.
Clientscript. registerstartupscript (this. GetType (), "tishi", "<SCRIPT type =" text/JavaScript "> alert ('your queried data does not exist! '); </SCRIPT> ");
// The prompt message is displayed. The page is not blank.
// System. Web. Extensions. DLL needs to be introduced in vs2005.
Scriptmanager. registerclientscriptblock (this. btntishi, typeof (button), "tishi", "alert ('your queried data does not exist! '); ", True );
// The prompt is displayed, but the page is blank.
Scriptmanager. registerclientscriptblock (this, this. GetType (), "tishi", "alert ('your queried data does not exist! '); ", True );
// The prompt is displayed, but the page is blank. This indicates page
Scriptmanager. registerstartupscript (this. btntishi, typeof (button), "tishi", "alert ('your queried data does not exist! '); ", True );
// The prompt message is displayed. The page is not blank.
Scriptmanager. registerstartupscript (page, typeof (PAGE), "tishi", "alert ('your queried data does not exist! '); ", True );
// The prompt message is displayed. The page is not blank.
Scriptmanager. registerstartupscript (this, typeof (_ default), "tishi", script, true );
// The prompt is displayed. The page is not blank. This indicates the page.
// The backend obtains the confirm return value and has the selected execution statement block.
C # end:
Protected void page_load (Object sender, eventargs E)
{
If (! Ispostback)
{
This. btntishi. Attributes. Add ("onclick", "tishi ()");
}
}
Protected voidbtntishi_click (Object sender, eventargs E)
{
If (this. hidevalue. value = "1 ")
{
Response. Write ("success ");
}
Else
{
Response. Write ("failue ");
}
}
JS end:
<SCRIPT type = "text/JavaScript">
Function tishi ()
{
If (confirm ('Are you sure you want to delete it? '))
{
Document. getelementbyidx_x ('hidevalue'). value = '1 ';
// Window. Location. href = Window. Location. href;
}
Else
{
Document. getelementbyidx_x ('hidevalue'). value = '0 ';
}
}
</SCRIPT>