c# - How to add gridview child controls values in dataset? -


i'm new .net development

i want add gridview values in dataset

in below code instead of using arraylist want use dataset

code:

private void getcheckboxstates() {     checkbox chkcol0 = (checkbox)empmastergrid.headerrow.cells[0]                             .findcontrol("chkcol0");     checkbox chkcol1 = (checkbox)empmastergrid.headerrow.cells[0]                             .findcontrol("chkcol1");     checkbox chkcol2 = (checkbox)empmastergrid.headerrow.cells[0]                             .findcontrol("chkcol2");     checkbox chkcol3 = (checkbox)empmastergrid.headerrow.cells[0]                             .findcontrol("chkcol3");     checkbox chkcol4 = (checkbox)empmastergrid.headerrow.cells[0]                             .findcontrol("chkcol4");     checkbox chkcol5 = (checkbox)empmastergrid.headerrow.cells[0]                             .findcontrol("chkcol5");     checkbox chkcol6 = (checkbox)empmastergrid.headerrow.cells[0]                             .findcontrol("chkcol6");     arraylist arr;      if (viewstate["ds"] == null)     {         arr = new arraylist();     }     else     {         arr = (arraylist)viewstate["ds"];     }     arr.add(chkcol0.checked);     arr.add(chkcol1.checked);     arr.add(chkcol2.checked);     arr.add(chkcol3.checked);     arr.add(chkcol4.checked);     arr.add(chkcol5.checked);     arr.add(chkcol6.checked);     viewstate["ds"] = arr; } 

here how add "chkcol0" in dataset

if (viewstate["ds"] == null) {   dataset  arr = new dataset  (); } else {     arr = (dataset)viewstate["ds"]; } arr.add("here how add chkcol0"); 

any ideas? in advance

        datatable dt = new datatable();         dt.columns.add("checkbox");         dt.rows.add("chkcol0",1);         dt.rows.add("chkcol1", 1);         dt.rows.add("chkcol2", 1);         dt.rows.add("chkcol3", 1);         dt.rows.add("chkcol4", 1);         dt.rows.add("chkcol5", 1);         dt.rows.add("chkcol6", 1);         dataset ds = new dataset();         ds.tables.add(dt); 

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -