Gridview paging and sorting do not work after changing datasource in codebehind?

  • I am having a gridview with an object datasource binded in the markup(aspx page). When page loads it directly works fine with all sorting and paging properties.
  • However, i need to filter display on gridview so i have to change the datasource of the gridview on the code behind.
  • It works fine.. i mean the filtering and displaying is good but paging and sorting doesnt work. Did you have a problem something like this?

-------------Problems Reply------------

dont change the gridviews datasource, check the object datasources properties instead, you can change its select query programatically.

Category:asp.net Views:0 Time:2010-03-05

Related post

  • asp.net gridview paging and sorting with linq to sql custom linq statement 2011-04-14

    Ok, I know this cant really be that hard, but im having trouble finding any info. I have a gridview on the page that i am filling with data based on a user selected date range(a dropdown list). When the user clicks the button i fill the gridview and

  • GridView Paging and Sorting 2012-02-24

    I have a GridView webcontrol that has paging and sorting enabled. I've bound the datasource to an SqlDataSource. When I try to change the page index or sort, I get a "GridView fired event [Sorting/PageIndexChanging] which wasn't handled" error. Isn't

  • MVC Paging and Sorting Patterns: How to Page or Sort Re-Using Form Criteria 2010-04-26

    What is the best ASP.NET MVC pattern for paging data when the data is filtered by form criteria? This question is similar to: http://stackoverflow.com/questions/1425000/preserve-data-in-net-mvc but surely there is a better answer? Currently, when I c

  • Is my gridview paging/sorting inefficient? 2009-10-25

    I'm using a web service which returns a list of products. I created a Grid View programmatically and used the list as the datasource. However, I can't use the Paging/Sorting methods as it causes errors since I'm not using an ObjectSource control. I h

  • GridView sorting doesn't work when I Enable Caching in Custome Paging and sorting 2009-12-29

    I have a GridView that use a stored procedure for custom paging and sorting . It's OK and works fine (Both paging and sorting) , But the problem is when i Enable Caching in ObjectDataSource like : EnableCaching="True" It properly cache every page tha

  • How to enable Paging and Sorting on ASP.NET 4.0 GridView programmatically? 2010-11-03

    I am using ASP.NET 4.0 with C# (Visual Web Developer 2010 Express). I have successfully managed to implement a simple GridView bound to a stored procedure data source using declarative ASP.NET code as shown here: <asp:GridView ID="grdTrades" runat

  • How should session variables be properly used for paging and sorting GridView? 2011-07-13

    I have an ASP .NET page with several GridView controls for which I'm implementing sorting and paging. I'm using session variables to maintain a DataTable representing a given page of the GridView data in the ViewState like so: protected void gv_Sorti

  • Issues with paging and sorting in asp.net gridview 2012-01-09

    I have a grid view where I am implementing both paging and sorting. When I sort the table and select page 2, then the sorting is lost and the second 20 records are displayed in desc as mentioned in gridview binding private DataSet BindGridView(string

  • Paging works Sorting fails ASP.NET Gridview control bould to IList 2012-04-02

    ASPX page: -Gridview Control as shown below <asp:GridView ID="gidtest" runat="server" AutoGenerateColumns="False" BackColor="White" BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px" CellPadding="4" Width="100%" AllowPaging="True" AllowSor

  • GridView ObjectDataSource LINQ Paging and Sorting using multiple table query 2010-06-16

    I am trying to create a pageing and sorting object data source that before execution returns all results, then sorts on these results before filtering and then using the take and skip methods with the aim of retrieving just a subset of results from t

  • Problem with a gridview, paging and "object reference not set" error 2008-09-23

    I'm stuck with the following problem. I'm trying to implement a basic GridView paged result set, which connects to an Oracle database. By itself, the GridView, and the paged results, work fine. The problem comes when I try to put it in page layout cl

  • In .NET 4.0 do you still need to handle gridview paging in code? 2010-07-16

    I haven't worked on the UI in some time. I thought that in ASP.NET 4.0, gridviews handle the paging automatically (if you set paging=true). Is this true, or do you still have to handle it in code? --------------Solutions------------- You will still n

  • ASP.NET GridView Paging using Linq query as datasource 2010-08-27

    I am looking for a way to do paging with a GridView when i set the datasource at run time using a linq query. here is my code: ETDataContext etdc = new ETDataContext(); var accts = from a in etdc.ACCOUNTs orderby a.account_id select new { Account = a

  • ASP.NET GridView Paging with IQueryable 2010-09-09

    I'm currently using IPagedList to efficiently page my data. When using with a GridView I can set the page index in the GridView.PageIndexChanging event and rebind the grid. The problem is, the GridView.PageCount property is readonly so the default pa

  • GridView paging in C# 2010-09-23

    I am using PageIndexChanging event for handling GridView paging in C#. But don't know how can to use PageSize/PageNumber/PageCount there. In other word my code is forced to return all data always. Note following code: protected void grdList_PageIndex

  • .NET Gridview Paging shows different content on following pages 2011-05-11

    I have a GridView in a page with paging enabled (sorting not enabled, not used). OnRowDataBound and OnPageIndexChanged events are assigned. <asp:GridView ShowHeader="False" ID="GV1" runat="server" AutoGenerateColumns="False" OnRowDataBound="gridVi

  • PagedDatasource for gridview paging 2011-08-22

    I am using PagedDataSource for gridview's custom paging. Here is the code: PagedDataSource dataSource = new PagedDataSource(); int virtualRowCount = Convert.ToInt32(dataset.Tables[1].Rows[0]["TotalRows"]); dataSource.AllowCustomPaging = true; dataSou

  • Linq to SQL in ObjectDataSource w/ GridView: IEnumerable manual sorting vs DataTable Auto-sorting? 2009-02-18

    The setup: I use Linq to Sql for my DAL and I extend the classes to encapsulate my CRUD methods (create, read, update, delete) for my BLL. I don't just use the LinqDataSource because I usually have to run some other subroutines whenever I do my norma

  • Can't get UpdatePanel to refresh on GridView paging 2009-08-04

    I have a GridView in an UpdatePanel (ASP.Net 2.0) . I have this code for the PageIndexChanging method of the grid view: protected void grdProductSearch_PageIndexChanging(object sender, GridViewPageEventArgs e) { grdProductSearch.PageIndex = e.NewPage

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.077 (s). 11 q(s)