Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Checkbox control - won't render attributes correctly

Reply
Thread Tools

Checkbox control - won't render attributes correctly

 
 
=?Utf-8?B?R3JhaGFt?=
Guest
Posts: n/a
 
      08-16-2005

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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Substitution control does not work correctly when render method is Peter ASP .Net 0 09-29-2008 04:00 PM
Accessing rails render method outside of view / Decorating render Glenn Gillen Ruby 0 11-17-2006 02:30 PM
ASP.NET Menu control with DynamicMenuStyle doesn't render correctly in Firefox Boske ASP .Net Web Controls 0 07-26-2006 08:55 AM
Page.Render do not render complete page Lau Lei Cheong ASP .Net 1 05-15-2004 04:10 AM
Controls don't render correctly in VS.NET with CSS Boris Zakharin ASP .Net 0 08-06-2003 12:53 AM



Advertisments