473,406 Members | 2,377 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Gridview and paging doesn't work

Hi everybody,

I'm working with a gridview (4 bound columns and 1 template column, using
databind from codebehind). It works just fine, but I tried to add paging,
and when I click any paging button (next, last, or page #), it return this
error and I don't know what's wrong:

Source Error:

An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.

Stack Trace:

[HttpException (0x80004005): The GridView 'GridView1' fired event
PageIndexChanging which wasn't handled.]
System.Web.UI.WebControls.GridView.OnPageIndexChan ging(GridViewPageEventArgs
e) +1427299
System.Web.UI.WebControls.GridView.HandlePage(Int3 2 newPage) +83
System.Web.UI.WebControls.GridView.HandleEvent(Eve ntArgs e, Boolean
causesValidation, String validationGroup) +488
System.Web.UI.WebControls.GridView.RaisePostBackEv ent(String
eventArgument) +199
System.Web.UI.WebControls.GridView.System.Web.UI.I PostBackEventHandler.RaisePostBackEvent(String
eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +174
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
Any idea?
Feb 14 '06 #1
6 6483
What kind of datasource are you binding to. IF you are binding to a
sqldatasource, then you should be able to do this wihout writing any
extra code. However, if you are binding to a custom object that returns
a collection, then, more work may have to be done.

Feb 14 '06 #2
Uhmmm... I'm binding it to a datatable obtained from an xml:

Dim ds As New Data.DataSet
Dim xml As String = library.H(x_parameter)
ds.ReadXml(New System.IO.StringReader(xml))
GridView1.DataSource = ds.Tables(0)
GridView1.DataBind()
ds.Dispose()

How do would you say I should do?

"tdavisjr" <td******@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
What kind of datasource are you binding to. IF you are binding to a
sqldatasource, then you should be able to do this wihout writing any
extra code. However, if you are binding to a custom object that returns
a collection, then, more work may have to be done.


Feb 14 '06 #3
Well, if you do it this way then to page and sort you may have to
handle the sort and page events on the gridview.
However, if you drag a objectdatasource and configure it to bind to
the xml file, then tell the gridview that is datasource is the
objectdatasource , and also enable paging and sorting on the gridview.
I think it will do this without you writing any code. Check out the
asp.net quickstart tutorials to see some examples

Feb 14 '06 #4
Uhmmm... already tried to do that but I obtained this error: "The data
source does not support server-side data paging."

One comment: the XML is not a file, is a function that RETURNS and xml to
pass data from one layer to another...

"tdavisjr" <td******@gmail.com> wrote in message
news:11*********************@g44g2000cwa.googlegro ups.com...
Well, if you do it this way then to page and sort you may have to
handle the sort and page events on the gridview.
However, if you drag a objectdatasource and configure it to bind to
the xml file, then tell the gridview that is datasource is the
objectdatasource , and also enable paging and sorting on the gridview.
I think it will do this without you writing any code. Check out the
asp.net quickstart tutorials to see some examples

Feb 14 '06 #5
Well. I would still use the objectdatasource, however, I would create
a class with one method that wrapps your function that returns xml,
however, I would take the xml and convert it to a dataset (i think
using, dataset.GetXml()) and return that to the objectdatasource. The
dataset should be able to sort and page.

Feb 14 '06 #6
Thanks a lot! Will ginna try this way.

"tdavisjr" <td******@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
Well. I would still use the objectdatasource, however, I would create
a class with one method that wrapps your function that returns xml,
however, I would take the xml and convert it to a dataset (i think
using, dataset.GetXml()) and return that to the objectdatasource. The
dataset should be able to sort and page.

Feb 14 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Raul | last post by:
Hi could some one help me, I have a datagrid displaying some info I set the property "AllowSorting=true" but it doesn't work. private void Page_Load(object sender, System.EventArgs e) { ...
1
by: joerage | last post by:
Hi, I use a grid view in asp.net 2.0 connecting to a objectdatasource. The datasource select method returns an arraylist of custom object. Reading the documentation for the objectdatasource, it...
5
by: Shimon Sim | last post by:
I just don't understand what is wrong. I have simple query. One of the returning fields is data I created bound column for GridView (ASP.NET 2.0) and specified DataFormatString as {0:d} - it...
0
by: wei | last post by:
Hello, all I get a little problem about this gridview paging event, it's work prefect in my local machine, even I used my IP address instead "localhost". when people use this web page, and try to...
1
by: Zule | last post by:
Hi, I am creating a Composite Control within which I have a GridView. In this GridView, I have three TemplateFields, the last one being a template with a LinkButton which is meant to be clicked...
6
by: Slavan | last post by:
Hello everyone, I have a gridView on my page that I bind to a dataTable in my code behind. I know that when I do that I need to implement pageIndexChanging event for paging functionality to work....
0
by: Don Miller | last post by:
Here is an example of what I believe is a bug in ASP.NET 2.0 GridView paging without postbacks (or at least not documented how to fix it). Once the GridView is displayed, clicking on any of the...
6
by: ewolfman | last post by:
Hi, Recently we've hired professional SEO services to help up promote our website. They claim that pages which contain ASP.NET's Gridview with paging will not be scanned by the different spiders...
1
by: Matt Winward | last post by:
Hi all. I've got a little problem with my gridview paging and I'm not sure how to resolve it. Basically, I'm handling all aspx requests with my own httphandler. This does a url rewrite, so...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.