Monday, 14 January 2013

Paging ListviewByQuery

protected void Page_Load(object sender, EventArgs e)
        {         
if (!IsPostBack)
            {
                //Yor code
            }
            else
            {

                if (!string.IsNullOrEmpty(this.Context.Request.QueryString["Paged"]))
                {
                    string queryString = string.Empty;
                    foreach (string key in this.Context.Request.QueryString.Keys)
                    {
                        if (key.ToLower() != "view")
                        {
                            queryString += key + "=" + this.Context.Request.QueryString[key] + "&";
                        }
                    }
                    SPUtility.Redirect(this.Context.Request.Url.GetLeftPart(UriPartial.Path), SPRedirectFlags.Default, HttpContext.Current, queryString);
                    return;
                }
            }
}

Its working fine for me

4 comments :

  1. That is doesn't work for me :-)

    ReplyDelete
  2. Does your website have a contact page? I'm having a tough time
    locating it but, I'd like to send you an e-mail.
    I've got some ideas for your blog you might be interested in hearing.
    Either way, great website and I look forward to seeing it develop over time.


    Feel free to surf to my website; Dragon City Gems Hack

    ReplyDelete
  3. In Is Post Back, there is SPQuery query, I put query.RowLimit = 50 & apply this query to listviewbyquery. When the page load, 50 items was displayed but page numbers is invisible. Therefore I can't move to next page. (my database is 40.000 records)
    could you please let me know how to make page number VISIBLE in listviewbyquery.
    Many Thanks

    ReplyDelete
    Replies
    1. Have you checked Resource throttling?

      Delete