我在gridview.now中保留了删除按钮如果我正在删除网格中的值,它正在工作并删除了特定的行。但是从网格中绑定的文本框值在删除行之后没有更改其值网格。
protected void gvInvoicePart_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
try
{
SetRowData();
if (ViewState["CurrentTable"] != null)
{
DataTable dt = (DataTable)ViewState["CurrentTable"];
DataRow drCurrentRow = null;
int rowIndex = Convert.ToInt32(e.RowIndex);
if (dt.Rows.Count > 1)
{
dt.Rows.Remove(dt.Rows[rowIndex]);
drCurrentRow = dt.NewRow();
ViewState["CurrentTable"] = dt;
gvInvoicePart.DataSource = dt;
gvInvoicePart.DataBind();
for (int i = 0; i < gvInvoicePart.Rows.Count - 1; i++)
{
gvInvoicePart.Rows[i].Cells[0].Text = Convert.ToString(i - 1);
}
SetPreviousData();
}
}
}
catch (Exception Ex)
{
LogEntry.Write("ClientToDoList_Invoice_gvInvoicePart_RowDeleting", Ex);
Response.Redirect("../ErrorMessage.aspx", false);
}
}