Textbox in header of Datagrid loosing viewstate

G

Grimsa

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>
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top