c# - how to update GridView row at once in sql database -
i have dll class call table
public datatable gettemtablevalue(string tablename) { sqlconnection conn = new sqlconnection(sconnectionstring); conn.open(); string query = "select * " + tablename + ""; sqlcommand cmd = conn.createcommand(); cmd.commandtext = query; datatable ds = new datatable(); sqldataadapter da = new sqldataadapter(cmd); da.fill(ds); conn.close(); return ds; }
and binding table grid view
private void loaddata() { clsdataaccess objdal = new clsdataaccess(); datatable ds = new datatable(); string objbll = ddltemtablelist.selectedvalue.tostring(); ds = objdal.gettemtablevalue(objbll); if (ds != null && ds.rows.count != 0) { lblnorecord.visible = false; foreach (datacolumn col in ds.columns) { //declare bound field , allocate memory bound field. boundfield bfield = new boundfield(); //initalize datafield value. bfield.datafield = col.columnname; //initialize headertext field value. bfield.headertext = col.columnname; //add newly created bound field gridview. gvdataentry.columns.add(bfield); } gvdataentry.datasource = ds; gvdataentry.databind(); gvdataentry.visible = true; } else { lblnorecord.visible = true; gvdataentry.datasource = null; gvdataentry.databind(); //gvdataentry.emptydatatext = "no recorddata found"; }
so table loading grid view. every time when change tables in dropdownbox , press search button columns change dynamically how can update data in grid view through using rowediting,rowupdating function , need store date in database?
Comments
Post a Comment