gridview
中有一行,其中列名为POA_NO
,其值为899
。
但我正在删除该值并将其更新为空白。但它仍然只更新为899
。
这是我的代码
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");
}
修改
页面加载代码
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 from xxcus.XXACL_PN_VIEW_DATA_INFO " +
"where mkey = '" + StrMkey + "' order by sr_no");
GrdDetail.DataSource = dtViewInfo;
GrdDetail.DataBind();
AddToViewState("GridViewInfo");