Problem with textboxes in headertemplate of gridview, events not fired

Last post 11-06-2006 7:57 PM by pinkfish. 1 replies.

Sort Posts:

  • Problem with textboxes in headertemplate of gridview, events not fired

    10-26-2006, 4:55 AM

    Hi,

    I already spend hours looking for this problem so if anybody can help me that would be just great!

    I have a page with a updatepanel, inside the updatepanel there is a gridview.  The gridview has a columnl with a headertemplate.  The column header has a TextBox.  I want to use this Textbox for "AJAX" filtering the GridView. 

    Here is my "simplified" aspx code:

       <asp:CheckBox ID="chkFixedUsers" runat="server" AutoPostBack="true" OnCheckedChanged="UpdateList" />
        
        <atlas:UpdatePanel ID="panel1" runat="server">
            <ContentTemplate>
                <asp:GridView ID="grvView" runat="server">
                    <Columns>                                                                           
                        <asp:TemplateField>
                            <headertemplate>
                                <asp:TextBox id="txtNumberFilter" runat="server" AutoPostBack="true" OnTextChanged="UpdateList" />
                            </headertemplate>
                            <itemtemplate>
                                <asp:Label id="lblNumberItem" runat="server" Text='<%# Bind("Number") %>'></asp:Label>
                            </itemtemplate>
                        </asp:TemplateField>                                     
                    </Columns>
                </asp:GridView>
            </ContentTemplate>
            <Triggers>
                <atlas:ControlEventTrigger ControlID="chkFixedUsers" EventName="CheckedChanged" />
            </Triggers>
        </atlas:UpdatePanel>


    As you can see, outside of the updatepanel I also have a checkbox, this checkbox is also for filtering the same GridView, it triggers the same server event as the TextBox should do.  This triggering is done via a ControleventTrigger and is working just fine.

    My problem is that my UpdateList event is not fired on the server when doing an OnTextChanged event in the TextBox, it works when clicking the checkbox.  I cannot create a ControlEventTrigger for the TextBox because the TextBox is in the NamingContainer of the GridView.  Also, the UpdateList event on the server causes a gridView.Databind() and so the TextBoxes are re-created.

    I think the solution is hooking the TextChanged event of the TextBox to the UpdateList but how and in which event do I do this?

    Thank you!
    Kind regards,
    Bert Janssens
     

  • Re: Problem with textboxes in headertemplate of gridview, events not fired

    11-06-2006, 7:57 PM
    • Loading...
    • pinkfish
    • Joined on 11-06-2006, 7:56 PM
    • Posts 1

    I am seeing the same problem with Checkboxes inside a repeater (in an update panel).

    Thanks,

    David.

Page 1 of 1 (2 items)
Microsoft Communities
Page view counter