Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-03-26
3
Medium Priority
?
466 Views
Last Modified: 2012-05-04
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.
0
Comment
Question by:africaoh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
locitt earned 200 total points
ID: 10697953
Dim txt As TextBox = IIf(AllowPaging,  CType(CType(CType(DataGrid1.Controls(0), Table).Rows(1), DataGridItem).FindControl("abc"), TextBox), CType(CType(CType(DataGrid1.Controls(0), Table).Rows(0), DataGridItem).FindControl("abc"), TextBox))

get the value of txt control.

HTH.
locitt.
0
 

Author Comment

by:africaoh
ID: 10700709
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...
0
 

Author Comment

by:africaoh
ID: 10700739
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
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

671 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question