Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Paging In GridView bound to DataSet

Reply
Thread Tools

Paging In GridView bound to DataSet

 
 
ES
Guest
Posts: n/a
 
      10-04-2006
Is there a reasonable way to implement paging in a GridView control that's
bound to a DataSet rather than a SqlDataSource? What needs to be done?

Thanks


 
Reply With Quote
 
 
 
 
ReyN
Guest
Posts: n/a
 
      10-04-2006

you don't have to change anything

paging will work in a GridView whether it's bound to SqlDataSource or a
DataSet

http://raven/aspxtreme/sys/web/ui/we...atasource.aspx

 
Reply With Quote
 
 
 
 
ReyN
Guest
Posts: n/a
 
      10-04-2006

ooops I posted the wrong link that's in my local host so here goes

http://authors.aspalliance.com/aspxt...atasource.aspx

 
Reply With Quote
 
ES
Guest
Posts: n/a
 
      10-05-2006
Thanks for your reply.
I initially just bound the GridView to the DataSet, and ran it. It worked fine until I clicked a page number. At that point it gave me an error about the OnPageIndexChanging being raised but not handled, so I implemented it as such:
protected void gvSrchMatch_PageIndexChanging(object sender, GridViewPageEventArgs e) {

gvSrchMatch.PageIndex = e.NewPageIndex;

}

This runs, but does not page correctly. The help file on this event speaks of canceling the move to the next page, but not actually making the control move to the next page.

Interestingly, your demo crashes when you click a page link...

Elton

"ReyN" <(E-Mail Removed)> wrote in message news:(E-Mail Removed) ps.com...
>
> ooops I posted the wrong link that's in my local host so here goes
>
> http://authors.aspalliance.com/aspxt...atasource.aspx
>

 
Reply With Quote
 
ReyN
Guest
Posts: n/a
 
      10-06-2006

you have to rebind the GridView after setting the PageIndex in the
event handler

 
Reply With Quote
 
ES
Guest
Posts: n/a
 
      10-10-2006
Thanks, I repopulated the grid, set the index, and bound and it appears to work. I think caching the dataset might make it more efficient. It seems wrong to get the whole dataset each time...

protected void gvSrchMatch_PageIndexChanging(object sender, GridViewPageEventArgs e) {

gvSrchMatch.DataSource = PvrProfile.GetMatches(txtSrchLastName.Text);

gvSrchMatch.PageIndex = e.NewPageIndex;

gvSrchMatch.DataBind();

}


"ReyN" <(E-Mail Removed)> wrote in message news:(E-Mail Removed) oups.com...
>
> you have to rebind the GridView after setting the PageIndex in the
> event handler
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Gridview bound with Code not allowing paging jerrygp@gmail.com ASP .Net 1 04-03-2007 01:22 AM
GridView bound to DataSet binds to...what precisely? Lee Boozer ASP .Net Datagrid Control 0 05-26-2006 07:45 PM
DetailsView GridView bound to DataSet not DataSourceControl mgbee ASP .Net Web Controls 0 05-11-2006 03:01 PM
Adding paging to a Gridview Control bound to DirectoryInfo.GetFiles() pittster@hotmail.com ASP .Net 2 12-07-2005 09:03 PM
DataSet paging vs Datareader paging =?Utf-8?B?UGF0cmljay5PLklnZQ==?= ASP .Net 1 10-08-2004 02:13 PM



Advertisments