jjc9809
asked on
GridView error about Paging
Hi Everyone,
I have tried to add paging to the GridView Property by making "Allow Paging" as True. When I run my Gridview, I get the error message, "The Data source does not support server-side data paging."
Please find my error message below. I have also included my HTML Source Code for the Gridview.
HTML-Source-Code-for-Gridview.pdf
Error-Gridview-AllowPaging.pdf
I have tried to add paging to the GridView Property by making "Allow Paging" as True. When I run my Gridview, I get the error message, "The Data source does not support server-side data paging."
Please find my error message below. I have also included my HTML Source Code for the Gridview.
HTML-Source-Code-for-Gridview.pdf
Error-Gridview-AllowPaging.pdf
ASKER
mroonal,
I used a Datatable as suggested, and the paging stil does not work. I am getting an error.
Please see error attached.
Server-Error-i1.doc
I used a Datatable as suggested, and the paging stil does not work. I am getting an error.
Please see error attached.
Server-Error-i1.doc
Create PageIndexChanging event and bind grid again in event.
Like this
string CurrentPage = e.CommandArgument.ToString ();
grdAbstract.AllowPaging = true;
grdAbstract.PageIndex = System.Convert.ToInt32(Cur rentPage) - 1;
Like this
string CurrentPage = e.CommandArgument.ToString
grdAbstract.AllowPaging = true;
grdAbstract.PageIndex = System.Convert.ToInt32(Cur
ASKER
Patel,
I have created a Page Index Changing Event on the gridview properties. Now do I store your code aboe inside this event along with my code for the gridview. I am not using the wizard and are writing my code using VB.Net insead of C# code. Are you using C# sharp code above.
VB.Net Code for this is:
Dim CurrentPage As String = e.CommandArgument.ToString ()
grdAbstract.AllowPaging = True
grdAbstract.PageIndex = System.Convert.ToInt32(Cur rentPage) - 1
Do I use my gridview ID for grdAbstract name you have indicated above?
My Gridview ID is called: GVContactF
My VB Code I have written is this:
Dim myConnection = New SqlConnection(clsDAL.Enfor cementInte lligenceCo nnection() )
Dim SQL As String
Dim cmdO As SqlCommand
SQL = "Select * FROM Contact_tbl WHERE FK_DriverLicenseID_vch Like '" & strLicense1.Text & "%'"
cmdO = New SqlCommand(SQL, myConnection)
Dim DA As New SqlDataAdapter(cmdO)
Dim DS As New DataSet()
DA.Fill(DS)
GVContactF.DataSource = DS
GVContactF.DataBind()
Do I store my VB code in the PageIndexChangingEvent too?
jjc9809
I have created a Page Index Changing Event on the gridview properties. Now do I store your code aboe inside this event along with my code for the gridview. I am not using the wizard and are writing my code using VB.Net insead of C# code. Are you using C# sharp code above.
VB.Net Code for this is:
Dim CurrentPage As String = e.CommandArgument.ToString
grdAbstract.AllowPaging = True
grdAbstract.PageIndex = System.Convert.ToInt32(Cur
Do I use my gridview ID for grdAbstract name you have indicated above?
My Gridview ID is called: GVContactF
My VB Code I have written is this:
Dim myConnection = New SqlConnection(clsDAL.Enfor
Dim SQL As String
Dim cmdO As SqlCommand
SQL = "Select * FROM Contact_tbl WHERE FK_DriverLicenseID_vch Like '" & strLicense1.Text & "%'"
cmdO = New SqlCommand(SQL, myConnection)
Dim DA As New SqlDataAdapter(cmdO)
Dim DS As New DataSet()
DA.Fill(DS)
GVContactF.DataSource = DS
GVContactF.DataBind()
Do I store my VB code in the PageIndexChangingEvent too?
jjc9809
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Code Cruiser,
DataReader is forward only. You can not traverse back and forth on it.
Either turn off your paging in GridView or use Datatable.
Reference:
http://forums.asp.net/p/1003175/1325804.aspx
Another approach:
http://borrell.parivedasolutions.com/2008/01/objectdatasource-linq-paging-sorting.html