Solved

Dynamically Changing Template Column HeaderText   When????? Example Please

Posted on 2004-09-03
5
983 Views
Last Modified: 2008-03-10
I am using asp Net C#.  I have a datagrid and I am using template columns.

the aspx  code looks like

                                                <asp:TemplateColumn >
                                                      <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle"></ItemStyle>
                                                      <HeaderTemplate>
                                                            <asp:label id="Label18" runat="server" Font-Names="Arial,Times New Roman,Verdana" Font-Size="10pt"
                                                                  Width="50 px" ForeColor="White" BackColor="#6495ed">Distance</asp:label>
                                                      </HeaderTemplate>

                                                      <ItemTemplate>
                                                            <asp:Label id="lblLabel18" Width="50" Text='<%# DataBinder.Eval(Container.DataItem,"Distance", "{0:F5}") %>' Runat="server">
                                                            </asp:Label>
                                                      </ItemTemplate>
                                                </asp:TemplateColumn>



In the aspx.cs code
I want to change the value of the header from"Distance" to something else based on the a value in the database.  

I have tried all your examples as you can see here :

                  dg.Columns[7].HeaderText = "MY TEST";

But the column still shows me "DISTANCE".

I have put the change in before, and after the databind but I still get "DISTANCE".

I am using C# with asp.net.  Many thanks in advance.
0
Comment
Question by:kathywargo
  • 2
5 Comments
 
LVL 4

Accepted Solution

by:
Sicos earned 125 total points
ID: 11977776
I think you need to disable the auto making of columns in the datagrid.

Greetings,

Sicos
0
 
LVL 4

Expert Comment

by:Sicos
ID: 12495345
I did give the solution...
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

911 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

23 Experts available now in Live!

Get 1:1 Help Now