Solved

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

Posted on 2004-03-26
3
451 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 50 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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
API v SOA 8 64
Reactjs with .NET 3 127
GET INFO ABOUT WHAT THE PRINTER IS DOING ? 11 76
Binding a GridView in ASP.NET(VB) using Using statements 6 19
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

759 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