Lounge - Need a site have paging in grid - Asked By Ali Khan on 19-Jan-12 04:51 AM

I need different sites address in which they have great amount of data,I want to see the paging performance in other sites.
kalpana aparnathi replied to Ali Khan on 19-Jan-12 04:56 AM
Try this code:
 
public int RottenTomatoesId { get; set; }
public string Title { get; set; }
public int Year { get; set; }
public string MpaaRating { get; set; }
public int? Runtime { get; set; }
public string Synopsis { get; set; }
public List<ReleaseDate> ReleaseDates { get; set; }
public List<Rating> Ratings { get; set; }
public List<string> Genres { get; set; }
public List<string> Directors { get; set; }
public List<CastMember> Cast { get; set; }
public MovieLinkCollection Links { get; set; }
public PosterCollection Posters { get; set; }
 
@model CherryTomato.Entities.MovieSearchResults
 
@{
  ViewBag.Title = "Movie Search";
  Layout = "~/Views/Shared/_Layout.cshtml";
  string title = string.Empty;
   
  var grid = new WebGrid(@Model, canPage: true);
}
 
@model CherryTomato.Entities.MovieSearchResults
 
@{
  ViewBag.Title = "Movie Search";
  Layout = "~/Views/Shared/_Layout.cshtml";
  string title = string.Empty;
   
  var grid = new WebGrid(@Model, canPage: true);
}
<div id="Results">
<form action="" method="post">
<input type="text" name="q" value="" />
<input type="submit" name="btnSubmit" value="Search" />
</form>  
 
@if (@Model != null && @Model.Count > 0)
{  
  @grid.GetHtml()
}   
Riley K replied to Ali Khan on 19-Jan-12 05:03 AM


Performance depends on the type of query also

suppose there are lots of join conditions then it will take some time

So, the efficient way is to do custom paging for gridview

You can view Greg Hamilton's article here: 
A More Efficient Method for Paging Through Large Result Sets

http://www.codeproject.com/KB/webforms/GridViewCustomPaging.aspx


Regards
Jitendra Faye replied to Ali Khan on 19-Jan-12 05:06 AM

For your solution check these things-


1. First Check

protected void Page_Load(object sender, EventArgs e)
{
  if (!IsPostBack)
   {
    //bind your Grid here
   }
}

2. set AllowPaging Property of GridView to True.


3.  Write following code in PageIndexChanging() event of GridView-

protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
 GridView1.PageIndex = e.NewPageIndex;
 //bind your Grid here
}

Follow this steps and let me know.

Sandeep Mittal replied to Ali Khan on 19-Jan-12 05:07 AM
Use custom paging in case of high volume data.
The custom paging is used to handle the huge data coming from the database based on the user's filter criteria. Example : you are getting say 20k records from the database based on user's filter criteria and you want to show 20 records in each page in gridview. In normal paging each time the page is changed, it fetches 20k records from the database or you have to manage it in viewstate that would be very inefficient. In custom paging the funda is to fetch only 20 records from the database on each page change.
Refer below post on my blog where i have demonstrated the step by step procedure for cutom paging

http://itdeveloperzone.blogspot.com/2011/01/custom-paging-in-grid-view.html
dipa ahuja replied to Ali Khan on 19-Jan-12 06:43 AM
There are so many sites which can have paging

mostly site of shopping items because it shows products of different catagory

http://goo.gl/hSOov
http://www.futurebazaar.com/electronics/ch/2458/ 

Ali Khan replied to dipa ahuja on 19-Jan-12 07:39 AM
thanks dipa
dipa ahuja replied to Ali Khan on 19-Jan-12 07:40 AM
welcome !