PC Review


Reply
Thread Tools Rate Thread

Checkbox control - won't render attributes correctly

 
 
=?Utf-8?B?R3JhaGFt?=
Guest
Posts: n/a
 
      16th Aug 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
Rate This Thread
Rate This Thread:

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 Microsoft ASP .NET 0 29th Sep 2008 05:00 PM
Controls do not seem to render correctly Volker Lehmann Microsoft Dot NET Compact Framework 1 28th Jun 2006 02:08 AM
IE AND Mozilla do not render correctly joe nedumgottil Windows XP Internet Explorer 1 2nd May 2006 10:09 PM
UTF-8 in ASCX will not render correctly Peter Styk Microsoft ASP .NET 0 12th Jan 2005 01:40 AM
Controls don't render correctly in VS.NET with CSS Boris Zakharin Microsoft ASP .NET 0 6th Aug 2003 01:53 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:07 PM.