Solved

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

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Normally the drop down box control found in the .Net framework tools is able to select just one data and value at a time, which is displayed on the text area.   But what if you want to have multiple values to be selected in the drop down box? As …
The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now