Textbox in header of Datagrid loosing viewstate

Discussion in 'ASP .Net Datagrid Control' started by Grimsa, Oct 22, 2003.

  1. Grimsa

    Grimsa Guest

    Hi,

    I have a templated column in a datagrid which contains a textbox
    control in the Header template.

    Does anyone know how to maintain the viewstate of the textbox after a
    datagrid rebind?

    (A postback without rebind DOES maintain the viewstate)

    Thanks in advance,

    Grimsa.


    My aspx snippet:

    <asp:datagrid id=dgrHauliers runat="server"
    OnItemDataBound="ItemDataBound" AutoGenerateColumns="False">

    <Columns>
    <asp:TemplateColumn HeaderText="Company ID">

    <HeaderTemplate>
    <asp:TextBox id=txtId Width="100%" Runat="server"
    OnTextChanged="TextChanged" AutoPostBack="True">
    </asp:TextBox>
    </HeaderTemplate>

    <ItemTemplate>
    <asp:Label id=Label1 runat="server" Text='<%#
    DataBinder.Eval(Container, "DataItem.Id") %>'></asp:Label>
    </ItemTemplate>

    </asp:TemplateColumn>
    </asp:datagrid>
    Grimsa, Oct 22, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Prodip Saha
    Replies:
    2
    Views:
    891
    Prodip Saha
    Dec 29, 2004
  2. Gauthier Segay

    Loosing ViewState on postback

    Gauthier Segay, Aug 10, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    3,049
    Gauthier Segay
    Aug 10, 2005
  3. mlt
    Replies:
    2
    Views:
    833
    Jean-Marc Bourguet
    Jan 31, 2009
  4. cmoore
    Replies:
    1
    Views:
    205
    Felix Wu [MSFT]
    Sep 11, 2003
  5. Henrik
    Replies:
    1
    Views:
    424
    Ken Cox [Microsoft MVP]
    Jul 6, 2006
Loading...

Share This Page