I have a checkbox inside a grid view.When i click on save button,i check at code behind which check boxes are checked to save record in db.butCheck box.checked property is always false.
foreach (GridViewRow row in GridView1.Rows)
{
CheckBox chbx = (CheckBox)row.FindControl("chk1");
if (chbx.Checked)
{
}}
However it works fine in Mozilla but not in IE
Loading
ashish dhingraPosted Jun 7, 2012, 3:41 AM
{
if (Request["hid1"] != null && Request["hid1"].Length>0 )
{
save();
}
else
{
bindgrid();
}
}
Save method code is written above in first post.
Aspx code:
asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" OnPageIndexChanging="ChangeGridView" PageSize="25" >
Jignesh TrivediPosted Jun 7, 2012, 3:09 AM
Can please share pieces of code?
Are you use HTML submit button? If yes so I think you can find all control using "Request.Params".
Request.Params is take name as key it retun value on and off.
hope this will help u.
ashish dhingraPosted Jun 7, 2012, 2:39 AM
Jignesh TrivediPosted Jun 7, 2012, 12:20 AM
I have tryed it it work fine for me in all browser.
I used code in aspx.
protected void btnTest_Click(object sender, EventArgs e)
{
foreach (GridViewRow row in GridView1.Rows)
{
CheckBox chbx = (CheckBox)row.FindControl("chkSelect");
// DO YOU CODE.
}
}
Hope this help you.