HTML is: <% @ Page Language = "VB" autoeventwireup = "false" codebehind = "webform1.aspx. VB" inherits = "oneclicktester. webform1" %> <% @ Register tagprefix = "mboc" namespace = "metabuilders. webcontrols" assembly = "metabuilders. webcontrols. oneclick" %> <! Doctype HTML public "-// W3C // dtd html 4.0 transitional // en"> <HTML> <Head> <Title> webform1 </title> <Meta content = "Microsoft Visual Studio. NET 7.1" name = "generator"> <Meta content = "Visual Basic. Net 7.1" name = "code_language"> <Meta content = "JavaScript" name = "vs_defaultclientscript"> <Meta content = "http://schemas.microsoft.com/intellisense/ie5" name = "vs_targetschema"> </Head> <Body ms_positioning = "gridlayout"> <Form ID = "form1" method = "Post" runat = "server" onsubmit = "If (document. forms [0]. submitted. value = '1') {alert ('You cannot resubmit the form'); Return false;} else {document. forms [0]. submitted. value = '1'; return true;} "> <Asp: button id = "button1" runat = "server" text = "button" enableviewstate = "true"> </ASP: button> <asp: label id = "result" runat = "server" enableviewstate = "false"> </ASP: Label> <mboc: oneclick id = "oneclick2" runat = "server"> </mboc: oneclick> <input id = "submitted" style = "Z-INDEX: 101; left: 40px; position: absolute; top: 56px "type =" hidden" Value = "0" runat = "server"> </form> </Body> </Html> Code behind is: Imports system. Data Imports system. Data. sqlclient Public class webform1 Inherits system. Web. UI. Page # Region "Web Form Designer generated code" 'this call is required by the web form designer. private sub initializecomponent () me. sqlconnection1 = new system. data. sqlclient. sqlconnection ' 'sqlconnection1 ' me. sqlconnection1.connectionstring = "workstation id = Sunil; packet size = 4096; Integrated Security = sspi; Data Source =" "Sunil" & _ "\ vsdotnet ""; persist Security info = false; initial catalog = echotangodb " End sub Protected withevents button1 as system. Web. UI. webcontrols. Button Protected withevents result as system. Web. UI. webcontrols. Label Protected withevents oneclick2 as metabuilders. webcontrols. oneclick Protected withevents sqlconnection1 as system. Data. sqlclient. sqlconnection Protected withevents submitted as system. Web. UI. htmlcontrols. htmlinputhidden 'Note: The following placeholder declaration is required by the web form designer. 'Do not delete or move it. Private designerplaceholderdeclaration as system. Object Private sub page_init (byval sender as system. Object, byval e as system. eventargs) handles mybase. init 'Codegen: This method call is required by the web Form Designer 'Do not modify it using the code editor. Initializecomponent () End sub # End Region Private sub page_load (byval sender as system. Object, byval e as system. eventargs) handles mybase. Load 'Put user code to initialize the page here Me. Submitted. value = "0" If ispostback then If oneclick2.isvalid then Session ("timessubmitted") = ctype (Session ("timessubmitted"), integer) + 1 System. Threading. thread. Sleep (timespan. fromseconds (10 )) Dim cmd as new sqlcommand ("Update Table1 set clicked =" + CSTR (ctype (Session ("timessubmitted"), integer), me. sqlconnection1) Me. sqlconnection1.open () Cmd. executenonquery () Me. sqlconnection1.close () End if Else Session ("timessubmitted") = 0 End if Result. Text = "Operation completed successfully" + CSTR (Session ("timessubmitted ")) End sub Private sub button#click (byval sender as object, byval e as system. eventargs) handles button1.click End sub End Class Sun21170 |