J
Jim Mitchell
I can now find the right page index when I know the unique ID for a table
sorted by account name as show below.
But... Does anyone know a more efficient way other than looping through the
whole dataset?
daAccounts = New SqlClient.SqlDataAdapter("Select * from tblCompanys where
ID < 200 order by Company", mycn)
daAccounts.Fill(dsAccounts)
For i = 0 To dsAccounts.Tables(0).Rows.Count - 1
If dsAccounts.Tables(0).Rows(i).Item("ID") = KNOWN_UNIQUE_ID Then
TextBox1.Text = i
Next
dgAccounts.CurrentPageIndex = Int(TextBox1.Text / dgAccounts.PageSize)
dgAccounts.DataSource = dsAccounts
dgAccounts.DataKeyField = "ID"
dgAccounts.DataBind()
sorted by account name as show below.
But... Does anyone know a more efficient way other than looping through the
whole dataset?
daAccounts = New SqlClient.SqlDataAdapter("Select * from tblCompanys where
ID < 200 order by Company", mycn)
daAccounts.Fill(dsAccounts)
For i = 0 To dsAccounts.Tables(0).Rows.Count - 1
If dsAccounts.Tables(0).Rows(i).Item("ID") = KNOWN_UNIQUE_ID Then
TextBox1.Text = i
Next
dgAccounts.CurrentPageIndex = Int(TextBox1.Text / dgAccounts.PageSize)
dgAccounts.DataSource = dsAccounts
dgAccounts.DataKeyField = "ID"
dgAccounts.DataBind()