Solved

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

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

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

I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
This video teaches users how to migrate an existing Wordpress website to a new domain.
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…

839 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