I am using ASP.NET 4.0. I checked a couple of links on this forum as well, but didn't find a solution that fits my requirement.
I have a GridView which gets populated using a query in a method. The query is below:
SELECT district_name, count(record_id) FROM districts;
I have disabled Auto Create Columns options and manually added two columns, viz: District and Count. It is obvious that the second column, i.e., Count is not in the DataSource as it is a computed result.
Someone suggested me to use #Eval("count") and so I tried:
<asp:BoundField DataField=<%#Eval("count") %> />
but it is also not working. I tried creating TemplateField, but not failed to make it work.
How to include this count column in the GridView?