jeudi 14 avril 2016

Create dynamic asp.net checkbox with value attribute

How do I add value attribute to checkbox in asp.net that is added dynamically to a panel. Eg:

CheckBoxList chkIrList = new CheckBoxList();
chkIrList.DataValueField = "UserId";
chkIrList.DataTextField = "Name";
chkIrList.DataSource = DT;
chkIrList.DataBind();

The generated html does not holds the value field:

<input id="ctl26_0" type="checkbox" name="ctl26$0">
<label for="ctl26_0">XYZ</label>




Aucun commentaire:

Enregistrer un commentaire