A Practical application of the confirm confirmation box (continued)

Source: Internet
Author: User
Tags form post

In a practical application in the confirm confirmation box, I used the icallbackeventhandler interface to rewrite the previous scheme.

 

The form post method is used for rewriting.

 

<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <br/> <HTML xmlns = "http://www.w3.org/1999/xhtml"> <br/> <pead runat = "server"> <br/> <title> </title> <br/> <SCRIPT type = "text/JavaScript"> <br/> function customsubmit () {<br/> var form = document. getelementbyid ('<% = form1.clientid %>'); <br/> document. getelementbyid ('hid '). value = Co Nfirm ('Are you sure you want to execute? '); <Br/> form. submit (); <br/>}</P> <p> </SCRIPT> <br/> </pead> <br/> <body> <br/> <Form ID =" form1 "runat =" server "> <br/> <input type =" hidden "id =" hid "name =" hname "/> <br/> <asp: button id = "btncallback" runat = "server" text = "send back and pop up confirm" onclick = "btncallback_click"/> <br/> <ASP: literal id = "login" runat = "server"> </ASP: literal> <br/> </form> <br/> </body> <br/> </ptml> <br/>

 

Private dictionary <bool, Action> DIC; </P> <p> protected void page_load (Object sender, eventargs e) <br/>{< br/> string value = request. form ["hname"]? ""; </P> <p> bool result; </P> <p> If (bool. tryparse (value, out result) <br/>{< br/> DIC = new dictionary <bool, Action> (); </P> <p> dic. add (true, confirm); <br/> dic. add (false, cancel); </P> <p> DIC [Result] (); <br/>}< br/> protected void btncallback_click (Object sender, eventargs E) <br/>{< br/> // run a piece of code <br/> quit. TEXT = datetime. now. tostring ("yyyy-mm-dd"); </P> <p> // pop-up confirm </P> <p> clientscript. registerstartupscript (GetType (), "Confirm", "customsubmit ();", true ); <br/>}</P> <p> // code executed upon confirmation <br/> private void confirm () <br/>{< br/> confirm. TEXT = "OK"; <br/>}</P> <p> // code executed during cancellation <br/> private void cancel () <br/> {<br/> enabled. TEXT = "cancel"; <br/>}

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.