Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Understanding the DataGrid
Message
De
12/10/2003 12:08:40
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
WebForms
Titre:
Understanding the DataGrid
Divers
Thread ID:
00837907
Message ID:
00837907
Vues:
61
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform