onClick event-handler for a server-side CheckBox runs on the client-side
(yes, you are right that check boxes do not have server-side Click event).
As I understand from the original post, the requirement is to run a JS
script on click of a checkbox; so onClick can be used.
"Eliyahu Goldin" <> wrote in message
news:...
What do you mean? Where will doJavascriptThing() run? In your example it
will run on server after a postback. By the way, there is no server event
OnClick for CheckBox control in the first place.
Eliyahu
"Shiva" <> wrote in message
news:...
> Hi Eliyahu,
>
> For a CheckBox server control, onClick attribute hooks a client-side JS
> event handler.
>
> "Eliyahu Goldin" <> wrote in message
> news:...
> This will add a server-side event. If a client-side one is needed,
> Attributes is the way to go.
>
> Eliyahu
>
> "Shiva" <> wrote in message
> news:...
> > Hi,
> >
> > You can directly add the onClick attribute to the checkbox as in
> > <asp:CheckBox onClick="doJavascriptThing()" runat=server>
> >
> > "Sjaakie Helderhorst" <> wrote in message
> > news:#...
> > Hello,
> > I need to add a Javascript event (onClick) to a servercontrol
> > (asp:checkbox). Checkbox is named 'cbDoMail'.
> > Assumed that 'cbDoMail.Attributes.Add("onClick", "doJavascriptThing()")
> > would do the job, unfortunately it didn't.
> >
> > Can anyone point me in the right direction?
> >
> > Thanks!
> >
> >
> >
>
>
>
|