Solved

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

Posted on 2004-09-03
5
982 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

757 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

21 Experts available now in Live!

Get 1:1 Help Now