Gridview control (1 Viewer)

KenHigg

Registered User
Local time
Today, 10:29
Joined
Jun 9, 2004
Messages
13,327
I don't understand th following code from msdn:

<%@ Page language="VB" %>

<html>
<body>
<form runat="server">

<h3>GridView Columns Example</h3>

<asp:gridview id="CustomersGridView"
datasourceid="CustomersSource"
autogeneratecolumns="true"
emptydatatext="No data available."
runat="server">

<columns>
<asp:boundfield datafield="CustomerID" headertext="Customer ID"/>
<asp:boundfield datafield="CompanyName" headertext="Company Name"/>
<asp:boundfield datafield="Address" headertext="Address"/>
<asp:boundfield datafield="City" headertext="City"/>
<asp:boundfield datafield="PostalCode" headertext="Postal Code"/>
<asp:boundfield datafield="Country" headertext="Country"/>
</columns>

</asp:gridview>

<!-- This example uses Microsoft SQL Server and connects -->
<!-- to the Northwind sample database. Use an ASP.NET -->
<!-- expression to retrieve the connection string value -->
<!-- from the Web.config file. -->
<asp:sqldatasource id="CustomersSource"
selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]"
connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
runat="server"/>

</form>
</body>
</html>


When I set autogeneratecolumns to true and then declare the bound columns, I get two sets of (duplicate) columns!?! Is their code wrong or am I missing something?
 

Users who are viewing this thread

Top Bottom