Reputation: 259
I have something like this sql query : Select Sum(value) from Database.table
. And i post this in to some gridView in asp.net web form.
<asp:gridview id="foo" runat="server" autogeneratecolumns="false">
<columns>
<asp:boundfield datafield="ID" headertext="Identifier" />
</columns>
</asp:gridview>
this Sum(VALUE)
don't have datafield
or i dont know what is this .How to change HeaderText of SUM(value) column
Upvotes: 0
Views: 437
Reputation: 4892
You nee to use an ALIAS
and then use it inside your DataField
Select Sum(value) AS SumOfValue from Database.table
Then
<columns>
<asp:boundfield datafield="SumOfValue" headertext="Identifier" /> // use the alias name here
</columns>
Upvotes: 1
Reputation: 584
Select Sum(value) As ColumnName from Database.table
Replace ColumnName with any name you'd like to give the column.
Upvotes: 1
Reputation: 434
You should use Select Sum(value) AS SomeColumnName and use it as your datafield.
Upvotes: 1