I have a DataView sorting below with DataGrid and Dataset.
When i try implementing default Paging with the DataGrid it gives error
when i want to SORT:-
Error:-
"CurrentPageIndex value. It must be >= 0 and < the PageCount. "
CAN ANYBODY FORWARD ME AN EXAMPLE WHERE I CAN SORT THE TABLE AND AT THE
SAME TIME PAGE!
Thanks!
I have the code below:-
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Not IsPostBack Then
With ddlAlpha
.Items.Add("A")
.Items.Add("B")
.Items.Add("C")
.Items.Add("D")
.Items.Add("E")
.Items.Add("F")
.Items.Add("G")
.Items.Add("H")
End With
End If
Dim objConn As SqlConnection
Dim strSql As String
strSql = "SELECT CompanyName, ContactName, ContactTitle, Phone "
_
& "FROM Customers"
objConn = New
SqlConnection(ConfigurationSettings.AppSettings("N orthwind"))
Dim sdaCust As New SqlDataAdapter(strSql, objConn)
Dim dstCust As New DataSet
sdaCust.Fill(dstCust, "Customers")
Dim dtbCust As DataTable = dstCust.Tables(0)
Dim dtvCust As New DataView(dtbCust)
dtvCust.RowFilter = "CompanyName LIKE '" &
ddlAlpha.SelectedValue.ToString & "%'"
dtvCust.Sort = "ContactName"
dtgCust.DataSource = dtvCust
dtgCust.DataBind()
End Sub
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!