Logo 
Search:

Asp.net Forum

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds

combining selecting and built-in paging

  Asked By: Geeske    Date: Feb 02    Category: Asp.net    Views: 657
  

I'm using a datagrid that use the built-in paging... Everything works just fine
I'm also using a kind of selection onto my data (dataview.Rowfilter = findstring)
This one gives some problems in combination with the paging.
When i ask for some data (e.g. price < 5 euro) i get the data into the datagrid, but when clicking on the next numbers of the paging, i get wrong data, (this is the data i would normally get in paging without selection)

Ok, this seems me logical, but what do i have to do to solve it?


Public Sub DataGrid2_PageChanger(ByVal objSender As Object, ByVal objArgs As DataGridPageChangedEventArgs)
'Moet public staan
'Treedt in actie bij het wisselen van de pageindex
Dim myDataSet As DataSet
myDataSet =
CType(Session("data"), DataSet)
DataGrid2.CurrentPageIndex = objArgs.NewPageIndex
DataGrid2.DataSource = myDataSet
DataGrid2.DataMember = "ArtikelTabel"
DataGrid2.DataBind()

End Sub


Private Sub btnFind_Click(ByVal sender As System.Object, ByVal objArgs As System.EventArgs) Handles btnFind.Click

Dim myDataSet As DataSet
Dim myDataTable As DataTable
myDataSet =
CType(Session("data"), DataSet)
myDataTable = myDataSet.Tables("ArtikelTabel")
Dim objDataView As New DataView(myDataTable)
Dim findString As String

'als alleen artikelnaam gezocht, geen prijs
If ((Not (txtFindArt.Text = "")) And (txtFindPrice.Text = "")) Then
findString = " ANaam LIKE '" & txtFindArt.Text & "*'"
End If
'als alleen prijs gevraagd, geen artikelnaam
If ((txtFindArt.Text = "") And (Not (txtFindPrice.Text = ""))) Then
If radio1.Checked Then
findString = " Prijs = " & txtFindPrice.Text
End If
If radio1.Checked Then
findString = " Prijs < " & txtFindPrice.Text
End If
If radio1.Checked Then
findString = " Prijs <= " & txtFindPrice.Text
End If
End If

If ((Not (txtFindArt.Text = "")) And (Not (txtFindPrice.Text = ""))) Then
If radio1.Checked Then
findString = " ANaam LIKE '" & txtFindArt.Text & "*'" + " Prijs = " & txtFindPrice.Text
End If => other problem, how to combine, this doesn't work...
If radio1.Checked Then
findString = " ANaam LIKE '" & txtFindArt.Text & "*'" + " Prijs < " & txtFindPrice.Text
End If
If radio1.Checked Then
findString = " ANaam LIKE '" & txtFindArt.Text & "*'" + " Prijs <= " & txtFindPrice.Text
End If
End If

objDataView.RowFilter = findString
DataGrid2.DataSource = objDataView
DataGrid2.DataBind()


'nog problemen als alle 2 samen
'nog problemen met paging!

End Sub

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on combining selecting and built-in paging Or get search suggestion and latest updates.




Tagged: