Generating <label> tag...

S

scsharma

Hi,
I am using data grid and i want to have a checkbox as one of the column.
For that i am creating a template class and in InstantiateIn(Control
container) function i am dynamically creating a check box and adding that
check box to control collection.
Since the checkbox generates <input> tag I would like to have corresponding
label so that i can set the associatedControlID property of the label to
checkbox. But when final HTML is generated instead of <label> tag I am seeing
<span> tag.
What am i doing wrong?Please help.

Here is the code:

public void InstantiateIn(Control container)
{
CheckBox cbx = new CheckBox();
Label lbl = new Label();
cbx.DataBinding +=new EventHandler(cbx_DataBinding);
lbl.DataBinding+=new EventHandler(lbl_DataBinding);
if (staticText !="")
lbl.AssociatedControlID = cbx.ID;
container.Controls.Add(lbl);
container.Controls.Add(cbx);
}
 
R

R. Thomas, aka Xtreme.Net

what do you mean by this :
Since the checkbox generates <input> tag I would like to have corresponding
label so that i can set the associatedControlID property of the label to
checkbox.
Are u trying to trach whick checkbox is clicked?
R. Thomas
 
S

scsharma

We have 508 compliance issues where every <input> tag should have associated
label. The label have to speicfy the control that it is associated to, in
this case the checkbox. This is done by setting the associatedControlID
property of label.
Thanks
Subhash
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top