Reputation: 1832
I would like to set the text of the columns. What is the correct syntax for the GridView
?
Me.gvRefBetweenLineOfBiz.DataSource = query
Me.gvRefBetweenLineOfBiz.DataBind()
EnableControlVisibility(True)
Upvotes: 0
Views: 519
Reputation: 83356
You'll likely want to disable the automatic generation of your columns, and create a BoundField for each column you want displayed in your GridView. Each BoundField
has a HeaderText
property which controls the column's header text.
From the docs:
<asp:gridview id="CustomersGridView"
datasourceid="CustomersSqlDataSource"
autogeneratecolumns="false"
autogenerateeditbutton="true"
allowpaging="true"
datakeynames="CustomerID"
runat="server">
<columns>
<asp:boundfield datafield="CustomerID"
readonly="true"
headertext="Customer ID"/>
<asp:boundfield datafield="CompanyName"
convertemptystringtonull="true"
headertext="Customer Name"/>
<asp:boundfield datafield="Address"
convertemptystringtonull="true"
headertext="Address"/>
<asp:boundfield datafield="City"
convertemptystringtonull="true"
headertext="City"/>
<asp:boundfield datafield="PostalCode"
convertemptystringtonull="true"
headertext="ZIP Code"/>
<asp:boundfield datafield="Country"
convertemptystringtonull="true"
headertext="Country"/>
</columns>
</asp:gridview>
Upvotes: 2