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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Saineshwar BageriRank #115 · 19.6K reputationPosted Dec 14, 2014, 6:15 PM EST
foreach (GridViewRow GVR in GridView1.Rows)
{
CheckBoxList chk = (CheckBoxList)GVR.Cells[1].FindControl("CheckBoxList1");
foreach (ListItem li in chk.Items)
{
if (li.Selected)
{
}
}
Manish Kumar ChoudharyRank #339 · 7.4K reputationPosted Dec 14, 2014, 6:17 PM EST
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
Chinna NethaRank #5,573 · 294 reputationPosted Dec 14, 2014, 7:51 PM EST
Chinna NethaRank #5,573 · 294 reputationPosted Dec 14, 2014, 7:51 PM EST
Saineshwar BageriRank #115 · 19.6K reputationPosted Dec 14, 2014, 7:55 PM EST
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 NethaRank #5,573 · 294 reputationPosted Dec 14, 2014, 8:41 PM EST
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
}
}
Manish Kumar ChoudharyRank #339 · 7.4K reputationPosted Dec 14, 2014, 8:53 PM EST
{
if (li.Selected)
{
//code
}
user chk1.Items chk2.Items or whatever u want
Chinna NethaRank #5,573 · 294 reputationPosted Dec 14, 2014, 9:13 PM EST