Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Understanding the DataGrid
Message
From
12/10/2003 12:08:40
 
 
To
All
General information
Forum:
ASP.NET
Category:
WebForms
Title:
Understanding the DataGrid
Miscellaneous
Thread ID:
00837907
Message ID:
00837907
Views:
60
I have the following code and I am wondering what should be triggered in order for the DataGrid to show the two rows:
Dim loData As DataSet
loData = New DataSet("Customer")

Dim ordersTable As New DataTable("Temp")
loData.Tables.Add("Temp")

ordersTable.Columns.Add("OrderID", Type.GetType("System.Int32"))
ordersTable.Columns.Add("OrderQuantity", Type.GetType("System.Int32"))
ordersTable.Columns.Add("CustID", Type.GetType("System.Int32"))

ordersTable.PrimaryKey = New DataColumn() {ordersTable.Columns("OrderID")}

' Add two rows of data.
Dim dr As System.Data.DataRow

dr = ordersTable.NewRow()
dr("OrderID") = 1
dr("OrderQuantity") = 2
dr("CustID") = 3
ordersTable.Rows.Add(dr)

dr = ordersTable.NewRow()
dr("OrderID") = 4
dr("OrderQuantity") = 5
dr("CustID") = 6
ordersTable.Rows.Add(dr)

DataGrid.DataSource = loData
DataGrid.DataMember = "Temp"
Once the last two lines executed, I can see the DataGrid displaying some part of the grid but there is no data about the two rows I added.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Next
Reply
Map
View

Click here to load this message in the networking platform