mardi 14 mars 2017

Checked gridview contents in datatable

I need to store specific column of all the checkbox checked gridview rows in a datatable on a button click. I tried this code. But nothing is stored in datatable dt and in string variable str.. How to achieve my requirement.. Please help...

Protected void btnmail_click(object sender EventArgs e) {
datatable dt=new DataTable() ; foreach( GridViewRow gvrow in grd. Rows) { Checkbox chk=(Checkbox) gvrow. FindControl("chkrow") ; if(chk. Checked==true) { string str=gvrow. Cells[1].Text; dt.Rows.Add(str); } } }




Aucun commentaire:

Enregistrer un commentaire