Set Input Radio to Checked in GridView
-
Hi guys Need advise, I created a Gridview with a in it. I can bind the value inside but however when i need compare if the input type button should be checked. I face the problem. I can't seem to set the radio button to checked after i compare with some validation :: foreach (GridViewRow row in GridView1.Rows) { if (row.Cells[1].Text == "Brandon Tan") { ((RadioButton)row.FindControl("gvradio1")).Checked = true } }
KaKaShi HaTaKe
-
Hi guys Need advise, I created a Gridview with a in it. I can bind the value inside but however when i need compare if the input type button should be checked. I face the problem. I can't seem to set the radio button to checked after i compare with some validation :: foreach (GridViewRow row in GridView1.Rows) { if (row.Cells[1].Text == "Brandon Tan") { ((RadioButton)row.FindControl("gvradio1")).Checked = true } }
KaKaShi HaTaKe
-
you need to replace your html radio button with asp radio button <asp:RadioButton ID="gvradio1" runat="server" />
but in these case the radio button will allow mutiple check but i need to restrict to select one only.
KaKaShi HaTaKe
-
Hi guys Need advise, I created a Gridview with a in it. I can bind the value inside but however when i need compare if the input type button should be checked. I face the problem. I can't seem to set the radio button to checked after i compare with some validation :: foreach (GridViewRow row in GridView1.Rows) { if (row.Cells[1].Text == "Brandon Tan") { ((RadioButton)row.FindControl("gvradio1")).Checked = true } }
KaKaShi HaTaKe
Try setting
<input type="Radio" name="gvradio" id="gvradio1" runat=server>
;