更新时间:2022-10-31 22:34:55
好的,您可以向容器添加标签,并通过如下所示的Attributes控件集合来设置for =.
OK, you can add a label to the container and set the for= via the controls Attributes collection as below.
private static HtmlGenericControl CreateHtmlInputCheckBoxControl(Filters filter)
{
HtmlGenericControl column = CreateColumn(filter);
column.Controls.Add(new HtmlInputCheckBox { ID = string.Format("{0}{1}", filter.ID, filter.ReportID), Checked = false });
HtmlGenericControl l = new HtmlGenericControl("label"){InnerText=filter.Caption};
l.Attributes["for"]= string.Format("{0}{1}", filter.ID, filter.ReportID);
column.Controls.Add(l);
return column;
}