Checkbox and Radiobutton onfocus events

P

Paul

Hi

I need to set up the onfocus event for a checkbox and
radiobutton server control from the codebehind page. I am
trying something like:

this.MyCheckbox.Attributes.Add("onfocus", "alert
('gotit');");

or

this.MyCheckbox.Attributes["onfocus"] = "alert
('gotit');");

but neither work.

As you can see in the generated code the onfocus seems to
apply to a span tag, not directly to the controls
themselves:

<span onFocus="alert('gotit');"><label
for="MyCheckbox">test</label><input id="MyCheckbox"
type="checkbox" name="MyCheckbox" /></span>

Identical code works for text boxes and list boxes, but
not for checkboxes or radiobuttons (or groups). I know
HTML supports the onfocus event for these two controls.

Any ideas?

Thanks, Paul.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top