c# - Updating values in gridview is not working -
there row in gridview
in there column name poa_no
value 899
.
but deleting value , updating blank. still getting updated 899
only.
here code
protected void grddetail_updatecommand(object sender, gridrecordeventargs e) { if (session["viewinfo"] != null) { dtviewinfo = (datatable)session["viewinfo"]; } else { return; } datarow[] drviewinfo = dtviewinfo.select("sr_no = " + e.record["sr_no"]); if (e.record["type"] != "") { drviewinfo[0]["type"] = e.record["type"]; } else { drviewinfo[0]["type"] = "null"; } if (e.record["ref_no"] != "") { drviewinfo[0]["ref_no"] = e.record["ref_no"]; } if (e.record["ref_date"] != "") { drviewinfo[0]["ref_date"] = e.record["ref_date"]; } if (e.record["poa_no"] != "") { drviewinfo[0]["poa_no"] = e.record["poa_no"]; } if (e.record["poa_date"] != "") { drviewinfo[0]["poa_date"] = e.record["poa_date"]; } if (e.record["poa_name"] != "") { drviewinfo[0]["poa_name"] = e.record["poa_name"]; } if (e.record["attachment"] != "") { drviewinfo[0]["attachment"] = e.record["attachment"]; } grddetail.datasource = dtviewinfo; grddetail.databind(); addtoviewstate("gridviewinfo"); }
edit
page load code
dtviewinfo = cf.executedt("select sr_no, type, ref_no, to_char (ref_date,'dd/mm/yyyy') ref_date, poa_no , to_char (poa_date, 'dd/mm/yyyy') poa_date, poa_name, attachment xxcus.xxacl_pn_view_data_info " + "where mkey = '" + strmkey + "' order sr_no"); grddetail.datasource = dtviewinfo; grddetail.databind(); addtoviewstate("gridviewinfo");
Comments
Post a Comment