How to Get the Label in a Header Template on GridView
A Microsoft .NET GridView header template lets programmers create a custom column that displays at the top of the GridView data columns. Header templates are static columns where you can create a design-time. They contain static text that describes the data in the column. Each time you refresh or reload data in the GridView, the header template also reloads, but the text does not change.
Instructions
-
-
1
Open the Visual Studio software from the Windows program menu. Open your .NET project that contains your GridView.
-
2
Double-click the form in Solution Explorer that contains the GridView. The designer opens and displays the form and the GridView. Click the "View Code" to open the coding editor.
-
-
3
Add a GridView header template with the label text. The following code shows you how to create a header template with the "Customer Name" label:
<headertemplate>
<asp:label id="columnHeader"
text="Customer Name"
runat="server"/>
</headertemplate>You can add as many of these templates as you need for your GridView control.
-
1