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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top