Link to home
Start Free TrialLog in
Avatar of africaoh
africaoh

asked on

datagrid <HeaderTemplate> -> enableviewstate on servercontrol not working... please see code fraction...

I have a datagrid with template columns, I use

<asp:TemplateColumn>
      <HeaderTemplate>
                        <asp:TextBox id="abc" runat="server"></asp:TextBox></td>
      </HeaderTemplate>
...

When enter data in my abc textbox and perform a postback my abc control does not maintain it's entered value..?? why ??

My datagrid is lying ontop of a panel, both enableviewstate is set to true.

Please help.
ASKER CERTIFIED SOLUTION
Avatar of locitt
locitt

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of africaoh
africaoh

ASKER

Hi locitt,

Yip thanks i got that working with the above, just thought asp.net would somehow be able to do that without me manually doing it...
This was what I did, working but like i said thought asp.net would be clever enough to have done that for me.

Dim srcPartNum As TextBox = CType(CType(CType(dtgItemMstr.Controls(0), Table).Rows(0), DataGridItem).FindControl("hdrSrcPartNum"), TextBox)

...
sql stuff
...

CType(CType(CType(dtgItemMstr.Controls(0), Table).Rows(0), DataGridItem).FindControl("hdrSrcPartNum"), TextBox).Text = srcPartNum.Text