|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to initiate a postback in a function?I would like to initiate a postback after I have finish executing some codes
in a dynamically created button_click event. Do anyone know? Please help!!! Thanks <script language=javascript>
function hello(){ <%= Page.ClientScript.GetPostBackEventReference(Me.cmdHello, "")%> } </script> Show quoteHide quote "cin" <c**@discussions.microsoft.com> schreef in bericht news:ABCC2C76-DC31-484A-A166-15ED697D7487@microsoft.com... >I would like to initiate a postback after I have finish executing some >codes > in a dynamically created button_click event. Do anyone know? Please > help!!! > Thanks > Hi Edwin,
do something like you posted above: <script runat="server"> protected override void OnLoad(EventArgs e) { string script = "function CustomPostback(){ " + Page.ClientScript.GetPostBackEventReference(this, null) + " }"; Page.ClientScript.RegisterClientScriptBlock( GetType(), "MyScript", script, true); base.OnLoad(e); } </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <input type="button" onclick="CustomPostback();" /> </div> </form> </body> </html> This is ASP.NET 2.0 code, in ASP.NET 1.1, the methods can be found on the Page class, e.g. Page.RegisterClientScriptBlock. Grtz, Wouter Trainer - Info Support - www.infosupport.com www.dive-in-it.nl
Other interesting topics
Using Components in ASP.NET (C#)
The system cannot find the file specified. (Exception from HRESULT: 0x80070002) Can't edit, delete or add row in an Access database in a website 2 XHTML 1.0 Event 1089 .ascx file as index page? Adding CssClass on .ascx page How to add Label control to DataList? Dynamically Loading the User Control and Passing Parameters to it. References VS Imports |
|||||||||||||||||||||||