C# OnRowUpdate事件和TextBox\u TextChanged事件未激发
我用一个链接按钮显示网格,如果我点击它,它将显示一个类似对话框(弹出窗口)的网格视图C# OnRowUpdate事件和TextBox\u TextChanged事件未激发,c#,asp.net,gridview,textbox,C#,Asp.net,Gridview,Textbox,我用一个链接按钮显示网格,如果我点击它,它将显示一个类似对话框(弹出窗口)的网格视图 <asp:GridView ID="HistoryGrid" runat="server" AutoGenerateColumns="false" AllowSorting="True" CellPadding="4" ForeColor="Black" AllowPaging="True" Font-Size="9pt" BackColor="White" BorderC
<asp:GridView ID="HistoryGrid" runat="server" AutoGenerateColumns="false" AllowSorting="True"
CellPadding="4" ForeColor="Black" AllowPaging="True" Font-Size="9pt" BackColor="White"
BorderColor="#DEDFDE" Width="100%" BorderWidth="1px" GridLines="Vertical" PageSize="10"
OnRowEditing="HistoryGrid_RowEditing" OnRowCancelingEdit="HistoryGrid_RowCancelingEdit" OnRowUpdating="HistoryGrid_RowUpdating"
OnRowUpdated="HistoryGrid_RowUpdated" OnRowDataBound="HistoryGrid_RowDataBound" >
使用
ItemTemplate
而不是EditItemTemplate
:
<asp:TemplateField>
<ItemTemplate>
<asp:TextBox ID="DateTxt" CssClass="datepick" runat="server" AutoPostBack="true" OnTextChanged="DateTxt_TextChanged" Font-Size="8.3pt" ></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
检查AutoEventWireup
在您的页面指令中是否为真。是真的,请等待您的回答。不管是什么,如果我更改了文本框中的文本,gridView(弹出窗口)将关闭。事件不是FireDY,您可以参考此
protected void DateTxt_TextChanged(object sender, EventArgs e)
{
//code
}
protected void HistoryGrid_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
//code
}
<asp:TemplateField>
<ItemTemplate>
<asp:TextBox ID="DateTxt" CssClass="datepick" runat="server" AutoPostBack="true" OnTextChanged="DateTxt_TextChanged" Font-Size="8.3pt" ></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>