It might be a simple question.
I am very new to ASP.Net 2, and stuck with a problem.
How can I execute a client side JavaScript function on CheckBox click.
I am able to execute function at server, But I don't know how to validate at
client side before going to server.
This code is within a GridView
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server"
Checked='<%# Bind("OpenConnection") %> '
Enabled="True"
OnCheckedChanged="OpenConnection_Clicked" AutoPostBack="True" />
</ItemTemplate>
When I put onClick="Javascript:FunctionName" within the tag, it says:
Validation (ASP.Net): Attribute'onclick' is not a valid attribute for
element 'CheckBox'.
Please help me.
I'll appreciate your help.
Thanks, Rob
Sergey Poberezovskiy - 23 May 2007 23:59 GMT
It looks like button would better suit the purpose - usually when you want to
perform an action (as you do with AutoPostBack="true") a button or a link is
the way to go, and you could use OnClientClick property to inject your
javascript
HTH
> It might be a simple question.
> I am very new to ASP.Net 2, and stuck with a problem.
[quoted text clipped - 18 lines]
>
> Thanks, Rob