c# - add a checkbox or a radio button inside a repeater after checking a condion in code behind -
i want add radiobutton or checkbox dynamically each record inside repeater after checking condition. depend on condtion decide control is... if condition true records should radio button else checkboxes. tried add condition myrpt_itemdatabound. got stuck. please me.
.aspx code
<asp:repeater id="myrpt" runat="server" onitemcommand="myrpt_itemcommand" onitemdatabound="myrpt_itemdatabound"> <headertemplate> <table> <tr class=""> <td> name </td> <td> address </td> <td> age </td> <td> year </td> </tr> </headertemplate> <itemtemplate> <tr> <td> ** place, want add control ** // need add checkbox or radiobutton after checking condition in code behind file </td> <td> <%#eval("name")%> </td> <td> <%#eval("address")%> </td> <td> <%#eval("age")%> </td> <td> <%# eval("year")%> </td> </tr> </itemtemplate> <footertemplate> </table> </footertemplate> </asp:repeater>
in code behind file
public void binduserdata() { myrpt.databind(); } protected void myrpt_itemdatabound(object sender, repeateritemeventargs e) { if (e.item.itemtype == listitemtype.alternatingitem || e.item.itemtype == listitemtype.item) { //check condition if(*******) { //should add radio button record } else { //shoud add check box record } } }
Comments
Post a Comment