Hi,
In my gridview i have put checkbox as checked but on button click it is coming as false.
here is my code:
<%#Container.DataItemIndex+1%>
------------------
protected void btn_rights_submit_Click(object sender, EventArgs e)
{
try
{
foreach (GridViewRow row in grdv_rights.Rows)
{
CheckBox chk = (CheckBox)row.FindControl("chkSelect");
if (chk.Checked)
{
lbl_user_rights.Text = "test";
}
}
}
catch(Exception ex)
{
obj_db.GetErrorFile("btn_rights_submit_Click", ex.Message);
}
}
{
try
{
foreach (GridViewRow row in grdv_rights.Rows)
{
CheckBox chk = (CheckBox)row.FindControl("chkSelect");
if (chk.Checked)
{
lbl_user_rights.Text = "test";
}
}
}
catch(Exception ex)
{
obj_db.GetErrorFile("btn_rights_submit_Click", ex.Message);
}
}
please help..
Sanjeeb LenkaPosted Feb 19, 2014, 4:37 AM
rachayita jaiswalPosted Feb 19, 2014, 4:36 AM
nothing i just changed gridview id name from "grdv_rights" to "grdv_questionsright" and it started working.
It strange for me but this was the only issue.
:)
Sanjeeb LenkaPosted Feb 19, 2014, 4:31 AM
what prblm you are facing with grid id.
ahsan iqbPosted Feb 19, 2014, 2:54 AM
set your button property: AutoPostBack = True.
That's all.
rachayita jaiswalPosted Feb 19, 2014, 1:40 AM
Gridview Id was creating problem.
rachayita jaiswalPosted Feb 19, 2014, 1:13 AM
this code i created:
CheckBox chk = (CheckBox)row.FindControl("chkSelect");
if (chk.Checked)
{
lbl_user_rights.Text = "test";
}
what's wrong in this?Plz tell me
Lakshmanan Sethu SankaranarayanPosted Feb 19, 2014, 12:35 AM