G
Guest
Is there a known bug with the CheckBox control?
I have subclassed the control and I am trying to add an onclick attribute in
the code behind. I've tried putting the Attributes.Add in the Page_Load,
Render, and OnPreRender - but none of them work!
The attributes are rendered in a span that envelopes the input control.
For example, in the OnPreRender I have:
this.Attributes.Add("onblur", "alert('myOnBlur')");
The generated output looks like this:
<span onblur="alert('myOnBlur')"><input id="checkBoxLoc" type="checkbox"
name="checkBoxLoc" /><label for="checkBoxLoc">LocalCheckBox</label></span>
Why is the onblur attribute rendered in the span instead of in the input tag?
If I set the attribute from the Page_Load of the main page, it seems to
work, but this isn't possible in my application. I really need the attributes
to be encapsulated within the control.
I can't use the HtmlCheckBox control because I want server events and
viewState.
I anybody can help, I would really appreciate it.
Thanks
Graham
I have subclassed the control and I am trying to add an onclick attribute in
the code behind. I've tried putting the Attributes.Add in the Page_Load,
Render, and OnPreRender - but none of them work!
The attributes are rendered in a span that envelopes the input control.
For example, in the OnPreRender I have:
this.Attributes.Add("onblur", "alert('myOnBlur')");
The generated output looks like this:
<span onblur="alert('myOnBlur')"><input id="checkBoxLoc" type="checkbox"
name="checkBoxLoc" /><label for="checkBoxLoc">LocalCheckBox</label></span>
Why is the onblur attribute rendered in the span instead of in the input tag?
If I set the attribute from the Page_Load of the main page, it seems to
work, but this isn't possible in my application. I really need the attributes
to be encapsulated within the control.
I can't use the HtmlCheckBox control because I want server events and
viewState.
I anybody can help, I would really appreciate it.
Thanks
Graham