Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to Implement paging in ListViewByQuery control

339 views
Skip to first unread message

JING

unread,
Nov 22, 2007, 2:56:00 AM11/22/07
to
Hi!

How do I implement paging in 'ListViewByQuery' control ? I think the paging
will be done automatically by setting the rowlimit in SPQuery. As shown in
the example , I have set SPQuery property RowLimit to 5. However the
'ListViewByQuery' control shows only the first 5 items
without a possibility to go to the next page.


See example code:
------------------------------
Dim MyQuery As New SPQuery()
MyQuery.Query = Query ' Set Query
MyQuery.ViewFields = ViewFields ' Set ViewFields
MyQuery.ViewAttributes = "BaseViewID=""1"" Scope=""Recursive"""
MyQuery.RowLimit = 5


MyListViewByQuery.List = List
MyListViewByQuery.Query = MyQuery
------------------------------



Are there any other additional controls that should be used together with
'ListViewByQuery' to make paging work?

Muhammad Hussain

unread,
Oct 30, 2011, 10:06:10 AM10/30/11
to
I am able to solve this issue

the problem is that when u click on the paged button 1-2> it will postback adding some values in query string.

Accidently i remove the "view=..." query string from url and press enter the i got the results.



So what i did is as follows



if






(!string.IsNullOrEmpty(Request.QueryString["View"

]))

{





string queryString = string

.Empty;





foreach (string key in

Request.QueryString.Keys)

{





if (key.ToLower() != "view"

)

queryString += key +



"=" + Request.QueryString[key] + "&"

;

}





SPUtility.Redirect(Request.Url.GetLeftPart(UriPartial.Path), SPRedirectFlags.Default, HttpContext

.Current,

queryString);





return

;
0 new messages