Looping through GridView rows and Checking Checkbox Control

后端 未结 2 1418
南方客
南方客 2020-12-04 01:21

I currently have a GridView which displays data from a Student Table, here is my Grid and associated SQLDataSource;

                      

        
2条回答
  •  天命终不由人
    2020-12-04 02:11

    you have to iterate gridview Rows

    for (int count = 0; count < grd.Rows.Count; count++)
    {
        if (((CheckBox)grd.Rows[count].FindControl("yourCheckboxID")).Checked)
        {     
          ((Label)grd.Rows[count].FindControl("labelID")).Text
        }
    }
    

提交回复
热议问题