well if you want to bind server side control with client side script.. and
if that object has a server side event as well... then your aspx should look
like this
<asp:Button id=Button1 onclick="javascript
:clientsideclick();"
onServerClick="serverEventHandler">
the preferred way is to use
Page.RegisterClientScriptBlock to register any custom javascript functions
you can hardcode the onclick and onserverclick
but again the preferred way is to use
Button1.Attributes.Add("onClick", "clientSideClick();");
Button1.Attributes.Add("onServerClick", "serverEventHandler");
hope this helps.. btw.. if you dont have server event you dont need to add
onServerClient attribute
--
Regards,
HD
"C" <an*******@discussions.microsoft.com> wrote in message
news:76**********************************@microsof t.com...
Hi,
I have a server side asp.net button on a web page.
On clicking the button I want to call some Javascript.
Can I not simply do a onclick="MyJavascript();" or is it necessary that I
add the onclick as an attribute in my codebehind?
Thanks,
C.