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.
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? How can i generate the <label> tag. 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);
}
Thanks
sharmasu
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.
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? How can i generate the <label> tag. 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);
}
Thanks
sharmasu