Getting DataTable, the data source, back from a datagrid?
How can I do this:
The code I am playing with is pretty simple.
I have displayed a datatable in my datagrid.
I can see the data perfectly.
I just want to know if I can do something like:
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim dt As DataTable = CType(MyDataGrid.DataSource, DataTable)
Response.Write(dt.Rows.Count.ToString)
End Sub
Or would I have to store the datatable in the viewstate of the page manually?
Woka
Re: Getting DataTable, the data source, back from a datagrid?
not sure about your question, havent tried it.
maybe a session variable or a temp xml file?
Re: Getting DataTable, the data source, back from a datagrid?
Quote:
Originally Posted by Wokawidget
How can I do this:
The code I am playing with is pretty simple.
I have displayed a datatable in my datagrid.
I can see the data perfectly.
I just want to know if I can do something like:
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim dt As DataTable = CType(MyDataGrid.DataSource, DataTable)
Response.Write(dt.Rows.Count.ToString)
End Sub
Or would I have to store the datatable in the viewstate of the page manually?
Woka
You'd have to use a viewstate. If you're worried about bandwidth though, and the dataset is extremely large, re-bind on each page load.
What are you trying to do though, which made you ask such a wokaic question?