If all you want to do is execute some script on submission of the form, use
Page.RegisterOnSubmitStatement(string key, string script). The caveat to
this is that it won't work for the auto postback feature of ASP.NET... So
LinkButtons, autopostback drop down lists, etc won't fire this event, only
actual submit buttons will:

*** HTML ***
<script type="text/javascript">
function doSomething() {
      alert("hello");
}
</script>

*** Page_Load ***

string script = "doSomething();";
this.RegisterOnSubmitStatement("myscript", script);

*** Output ***

<form name="Form1" method="post" action="WebForm1.aspx" language
="javascript" onsubmit="doSomething();" id="Form1">

adam..

>I was trying to do client side stuff, that is the problem.
>
>Apparently, ASP.NET already uses client-side form.onsubmit and
>submit.onclick when it writes the code for webforms.  What I wanted to
>do was put my own function in the client script that uses submit.onclick
>or form.onsubmit.  But I can't figure out how to add my javascript to
>the code that .NET generates.




---
You are currently subscribed to dotnet as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

---------
Administrated by 15 Seconds : http://www.15Seconds.com
List Archives/Search : http://local.15Seconds.com/search
Subscription Information : http://www.15seconds.com/listserv.htm
Advertising Information: http://www.internet.com/mediakit/


Reply via email to