Solved

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

Posted on 2004-03-26
3
450 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
  • 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Modal Popup Extender control 1 38
.NET 2008 VB and C# 6 39
What are the simplest ways to create a Merge Sort? 3 29
SSIS Feed MS SQL Server Stored procedure with loop 4 37
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

820 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