I have a list that I bind to a GridView, so my GridView will only have one column of these string values. I want to have the appropriate header text for this column. Please help me. See what I tried to do:
<asp:GridView ID="GridView1" runat="server" Width="95%">
<Columns>
<asp:BoundField HeaderText="My List" />
</Columns>
</asp:GridView>
And in the code behind:
List<string> myList = new List<string>();
:
:
:
:
GridView1.DataSource = myList;
GridView1.DataBind();
When I run this code, I get two columns in the GridView. The first column has heading text as βMy Listβ and has empty rows, while the second column has heading text as βItemβ and has rows with myList values. I want to have only one column in my GridView with a text heading like "My List" and rows with the values ββof the myList object.
thank
source
share