2017-04-04 17 views
0

を解雇していない私はそれをクリックすると、それがグリッド.Thatダイアログ(ポップアップ)のようなGridViewのは、OnRowUpdatingイベントとTextBox_TextChangedイベント

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

とで表示され、一つのリンクボタンでグリッドを示していますHistoryGridにはTextBoxが1つ含まれています。

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

ここで、TextBox_TextChangedイベントとHistoryGrid_RowUpdatingイベントは発生していません。代わりにEditItemTemplate

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

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

チェック 'AutoEventWireup属性は'あなたのpageディレクティブに真です。 – Arshad

+0

それは既に本当です – user7415073

答えて

0

使用ItemTemplateの後ろ

コード:

<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> 
+0

あなたの答えをありがとう。それが何であれ、TextBoxのテキストを変更した場合、gridView(Popup)はClosedを取得し、イベントは発生しません。 – user7415073

+0

これを参照できます。http://www.dotnetfunda.com/codes/show/3026/textbox-change-event -inside-gridview – Arshad

+0

更新パネルが必要だと思います – Arshad

関連する問題