?
Solved

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

Posted on 2004-09-03
5
Medium Priority
?
990 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
2 Comments
 
LVL 4

Accepted Solution

by:
Sicos earned 500 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses
Course of the Month15 days, 9 hours left to enroll

850 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