Product Description

 Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

Dim grid1 As ASPxGridView = New ASPxGridView() grid1.ID = "grid1" Page.Form.Controls.Add(grid1) grid1.AutoGenerateColumns = False grid1.DataSourceID = "SqlDataSource1" grid1.KeyFieldName = "ProductID" grid1.Columns.AddRange(New GridViewDataColumn() { New GridViewDataColumn With { .FieldName = "ProductID", .[ReadOnly] = True, .VisibleIndex = 0 }, New GridViewDataColumn() With { .FieldName = "ProductName", .VisibleIndex = 1 }, New GridViewDataColumn() With { .FieldName = "UnitPrice", .VisibleIndex = 2 } }) End Sub


<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\nwind.mdb; Persist Security Info=True" ProviderName="System.Data.OleDb" SelectCommand="SELECT [ProductID], [ProductName], [UnitPrice], [UnitsInStock] FROM [Products]"> </asp:SqlDataSource>


<dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" KeyFieldName="ProductID" Theme="MaterialCompact"> <Columns> <dx:GridViewDataTextColumn FieldName="ProductID" ReadOnly="True" VisibleIndex="0"> <EditFormSettings Visible="False" /> </dx:GridViewDataTextColumn> <dx:GridViewDataTextColumn FieldName="ProductName" VisibleIndex="1"> </dx:GridViewDataTextColumn> <dx:GridViewDataTextColumn FieldName="UnitPrice" VisibleIndex="2"> </dx:GridViewDataTextColumn> </Columns> </dx:ASPxGridView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\nwind.mdb; Persist Security Info=True" ProviderName="System.Data.OleDb" SelectCommand="SELECT [ProductID], [ProductName], [UnitPrice], [UnitsInStock] FROM [Products]"> </asp:SqlDataSource>