How To check gridview row selected or not ?
check gridview row selected or not
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Chinna NethaPosted Dec 15, 2014, 2:13 AM
Manish Kumar ChoudharyPosted Dec 15, 2014, 1:53 AM
{
if (li.Selected)
{
//code
}
user chk1.Items chk2.Items or whatever u want
Chinna NethaPosted Dec 15, 2014, 1:41 AM
foreach (GridViewRow GVR in GridView1.Rows)
{
CheckBoxList chk1 = (CheckBoxList)GVR.Cells[1].FindControl("CheckBoxList1");
CheckBoxList chk2 = (CheckBoxList)GVR.Cells[2].FindControl("CheckBoxList2");
CheckBoxList chk3 = (CheckBoxList)GVR.Cells[3].FindControl("CheckBoxList3");
CheckBoxList chk4= (CheckBoxList)GVR.Cells[4].FindControl("CheckBoxList4");
foreach (ListItem li in chk.Items)
{
if (li.Selected)
{
//code
}
}
Saineshwar BageriPosted Dec 15, 2014, 12:55 AM
foreach (GridViewRow GVR in GridView1.Rows)
{
CheckBoxList chk = (CheckBoxList)GVR.Cells[1].FindControl("CheckBoxList1"); //
foreach (ListItem li in chk.Items)
{
if (li.Selected) // it means its selected true
{
}
}
Chinna NethaPosted Dec 15, 2014, 12:51 AM
Chinna NethaPosted Dec 15, 2014, 12:51 AM
Manish Kumar ChoudharyPosted Dec 14, 2014, 11:17 PM
Hi Chinna Netha,
Go through following links it might help u
http://www.c-sharpcorner.com/UploadFile/20abe2/get-row-cell-value-from-grid-view-of-checked-checkbox-in-asp/
http://www.codeproject.com/Articles/12666/GridView-Delete-with-Confirmation
Saineshwar BageriPosted Dec 14, 2014, 11:15 PM
foreach (GridViewRow GVR in GridView1.Rows)
{
CheckBoxList chk = (CheckBoxList)GVR.Cells[1].FindControl("CheckBoxList1");
foreach (ListItem li in chk.Items)
{
if (li.Selected)
{
}
}