.NETGURU
VS / CLR (minor) Issue
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngvs' list.


Dot Net Guruhew Tamm
Just found an annoying little issue...

If a have an <asp:checkbox runat="server" id="myCheckbox" text="A Checkbox"
/>

In my code-behind I will add a custom attribute:

myCheckbox.Attributes.Add("myCustomAttribute", "myCustomValue");

the problem is, this is rendered as:

<span myCustomAttribute="myCustomValue"><input type="checkbox"
id="myCheckbox" name="myCheckbox"><label for="myCheckBox">A
Checkbox</label></span>

As you can see, the custom attribute is added to the SPAN of the rendered
control, but not on the actual checkbox control, where you would expect and
need it to be.

Thank you

Dot Net Guruhew

Reply to this message...
 
    
Andy Smith
I found this issue as well, and a workaround is to use the =
HtmlInputCheckbox instead of the CheckBox.

This behavior happens because the CheckBox supports adding a label to =
it, and they wanted to make sure that any styles or such that you apply =
to the CheckBox, also apply to the label. ( I'm assuming there )

the HtmlInputCheckbox gives you more control over the rendered tag, so I =
suggest you use that instead.

__
Andy Smith
Keyboard Jockey #3a7-2.78.1

[Original message clipped]

Reply to this message...
 
    
Dot Net Guruhew Tamm
exactly where I went! Bummer that you lose the label though. Guess you
can't have it all!

Dot Net Guru.

----- Original Message -----
From: "Andy Smith" <Click here to reveal e-mail address>
To: "aspngvs" <Click here to reveal e-mail address>
Sent: Monday, July 15, 2002 1:44 PM
Subject: [aspngvs] RE: VS / CLR (minor) Issue

I found this issue as well, and a workaround is to use the HtmlInputCheckbox
instead of the CheckBox.

This behavior happens because the CheckBox supports adding a label to it,
and they wanted to make sure that any styles or such that you apply to the
CheckBox, also apply to the label. ( I'm assuming there )

the HtmlInputCheckbox gives you more control over the rendered tag, so I
suggest you use that instead.

__
Andy Smith
Keyboard Jockey #3a7-2.78.1

[Original message clipped]

Reply to this message...
 
 
System.Web.UI.WebControls.CheckBox
System.Windows.Forms.CheckBox




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification