Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Understanding the DataGrid
Message
From
12/10/2003 12:28:57
 
 
To
12/10/2003 12:08:40
General information
Forum:
ASP.NET
Category:
WebForms
Miscellaneous
Thread ID:
00837907
Message ID:
00837910
Views:
35
This message has been marked as the solution to the initial question of the thread.
Michel,

I'm not sure if this is right, because I don't have .NET on this computer to test out the syntax or anything, but perhaps the problem is with this line:
loData.Tables.Add("Temp")
Maybe it should be this:
loData.Tables.Add(ordersTable)
~~Bonnie


>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.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform