简体   繁体   English

未触发OnRowUpdating事件和TextBox_TextChanged事件

[英]OnRowUpdating event and TextBox_TextChanged Event not fired

I am showing the Grid with one link button, if i click that, it will show a GridView like a dialog(Popup).That Grid is, 我正在显示带有一个链接按钮的网格,如果单击该按钮,它将显示一个像对话框(Popup)的GridView。

<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" >

and the HistoryGrid has one Column contains TextBox. 而HistoryGrid有一个包含TextBox的列。

<Columns>
        <asp:TemplateField><EditItemTemplate>
                <asp:TextBox ID="DateTxt" CssClass="datepick" runat="server" AutoPostBack="true" OnTextChanged="DateTxt_TextChanged" Font-Size="8.3pt" ></asp:TextBox>
                </EditItemTemplate></asp:TemplateField>

Now the Problem Is the TextBox_TextChanged Event and The HistoryGrid_RowUpdating event are not Firing. 现在问题是TextBox_TextChanged事件和HistoryGrid_RowUpdating事件没有触发。

Code Behind 背后的代码

protected void DateTxt_TextChanged(object sender, EventArgs e)
{
 //code
}

protected void HistoryGrid_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
 //code
}

Use ItemTemplate instead of EditItemTemplate : 使用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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM