hi all i have a search page displaying a number of products in a datagrid.
i have added a couple of dropdownboxes to the page for changing the pagesize of the datagrid and reordering it.
to eliminate the amount of times the db is polled i want to do this using the dataset rather than repolling with a different ORDER BY.
there are a couple of problems. at the moment i have the following
Sub sortByClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles sortBy.SelectedIndexChanged, pageSize.SelectedIndexChanged
Dim oDataSet As DataSet = search_datagrid.datasource 'CreateDataSource() <- old method will poll the db for results (with generic orderby product name)
Dim myView As DataView
myView = oDataSet.Tables(0).DefaultView
myView.Sort = sortBy.Text + " DESC"
search_datagrid.PageSize = pageSize.SelectedItem.Value
search_datagrid.DataSource = oDataSet
a) how do i get the dataset from the datagrid as the above code doesn't like me trying to grab it here
b)if i use my CreateDatasource method instead then the code runs however running the change on order seems to have no effect (even though the code is being ran)
c)if i have the datagrid on the last page and then try resizing the pagesize i get the following error
Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount.
can anyone tell me why?
many thanks in advance,