C# 无法更新.net中的gridview值
在更新gridview记录时。旧值只能更新。我正在使用绑定字段。在im获取变量中的数据时获取旧值C# 无法更新.net中的gridview值,c#,asp.net,gridview,C#,Asp.net,Gridview,在更新gridview记录时。旧值只能更新。我正在使用绑定字段。在im获取变量中的数据时获取旧值 <asp:GridView runat="server" ID="GvLeads" AutoGenerateColumns="false" AutoGenerateEditButton="true" AutoGenerateDeleteButton="true" OnRowDeleting="GvLeads_RowDeleting" OnRowEditing="GvLeads_RowEditi
<asp:GridView runat="server" ID="GvLeads" AutoGenerateColumns="false" AutoGenerateEditButton="true" AutoGenerateDeleteButton="true" OnRowDeleting="GvLeads_RowDeleting" OnRowEditing="GvLeads_RowEditing" OnRowCancelingEdit="GvLeads_RowCancelingEdit" EmptyDataText="No Records Found" OnRowUpdating="GvLeads_RowUpdating" OnRowDeleted="GvLeads_RowDeleted">
<Columns>
<asp:BoundField HeaderText="Id" DataField="LeadId" />
<asp:BoundField HeaderText="Company" DataField="Companyname" />
</Columns>
</GridView >
这通常发生在您在
Page\u Load
上填充网格时,只要在调用Page\u Load
事件之前调用了rowupdateing
事件get,该事件使用初始值填充网格。如何避免?使用!iPostback
为此目的
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindGrid(); // For e.g.
}
}
欢迎光临,很高兴帮助您。
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindGrid(); // For e.g.
}
}