A. F. M. Golam Kibria February 2016
why does gridview create two colums when gridview columns are bound in aspx page
I have declared a gridview in aspx page as follows:
<asp:GridView ID="grdDataView" runat="server">
<asp:boundfield datafield="divisionname" headertext="Division Name"/>
<asp:boundfield datafield="designation" headertext="Designation"/>
<asp:boundfield datafield="noofemployee" headertext="No of Employee"/>
I bound gridview in a button click as follows:
grdDataView.DataSource = dt;
where dt contains column name divisionname,designation and noofemployee. It shows me the following output
I need to avoid second group of column in black rectangular box. How this can be done?
Barry Franklin February 2016
You need to set the property "AutoGenerateColumns" to "false".
<asp:GridView ID="grdDataView" runat="server" AutoGenerateColumns="false">
or else it will generate the columns automatically along with the columns that you specify specifically in your code.
Asked in February 2016
Viewed 3,159 times
Answered 1 times
Leave an answer
Quote of the day: live life