| Dart Home | PowerWEB LiveControls for ASP.NET | Custom Development | Reply | PowerWEB LiveControls for ASP.NET Topics | Forums |
| Author | Forum: PowerWEB LiveControls for ASP.NET Topic: onclick event does not work with LiveButton |
| administrator weiner@parrotsoftware.com From: West Bloomfield, MI USA Posts: 55 Member Since: 12/12/05 |
posted June 28, 2006 7:11 PM Put a ms button and and live button on a webform. Put the following code in the load event: ClientScript.RegisterStartupScript(Me.GetType(), "MyScript", "<script Language=javascript>" & "function AlertHello() { alert('Hello ASP.NET'); }</script>") Button1.Attributes("onclick") = "AlertHello()" Button2.Attributes("onclick") = "AlertHello()" Clicking the ms button fires the event but live button does not. Using version 1.5 |
John Talarico![]() From: Rome, NY USA Posts: 630 Member Since: 06/01/05 |
posted June 29, 2006 12:23 PM Because LiveControls raise server events through callbacks initiated by client script, the onclick attribute has already been populated by the necessary callback function. If you would like to execute client script when the LiveButton is clicked, you can use the BufferedScript property in the LiveButton_Click handler within code-behind: LiveButton1.BufferedScript.Write("AlertHello();") If you want to exert more control over the process and execute the client function before performing the callback, you can use a combination of a LiveCallback control and standard HTML button with an onclick attribute which calls a custom function (e.g. AlertWithCallback). In this function you would call AlertHello(), then execute a call to pwBeginCallServerFunction to raise a server event through a callback. For more information on LiveCallback and how to use it to raise a server event as I've described, see the product documentation under "Advanced Topics" titled "Creating Custom Callbacks with LiveCallback". |
| Reply | PowerWEB LiveControls for ASP.NET Topics | Forums |
This site is powered by
PowerTCP WebServer for ActiveX
|