Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In a Gridview I have a column and its header text contains " Actual Cost per entry".
I intend to change the color of the particular word 'Actual' to red. How to make it? I tried with 'Span' but not accepting.

HeaderText= "Actual Cost per entry"
Posted

1 solution

you should have to use template to do any modification like this
ASP.NET
<asp:gridview id="gvExpences" runat="server" xmlns:asp="#unknown">
    <columns>
        <asp:templatefield>
            <HeaderTemplate>
                <span style="color:red;">Actual</span><span style="color:black;"> Cost per entry</span>
            </HeaderTemplate>
            <itemtemplate>
                <asp:label id="lblCost" runat="server" text="<%#Bind("Cost")%>"></asp:label>
            </itemtemplate>
        </asp:templatefield>
                 <asp:templatefield>
            <HeaderTemplate>
                <span style="color:red;">Entry</span><span style="color:black;"> Time</span>
            </HeaderTemplate>
            <itemtemplate>
                <asp:label id="lblCost" runat="server" text="<%#Bind("EntryTime")%>"></asp:label>
            </itemtemplate>
        </asp:templatefield>
    </columns>
</asp:gridview>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900