Technical support This forum is closed.
Version 1.x > Technical support > Page numbers View modes: 
User avatar
Member
Member
wahid - 4/8/2005 3:48:57 AM
   
Page numbers
Is there a way to browse through pages (news for examples) using page numbers?
Do you suggest a way of doing it?

User avatar
Guest
admin - 4/8/2005 2:11:51 PM
   
Re: Page numbers
Hi Wahid,

Do you mean how to add paging with numbers to the CMSRepeater control?

Thank you.

Best Regards,

User avatar
Member
Member
wahid - 4/8/2005 5:13:18 PM
   
Paging
Yes, that's what I meant. Would it be only possible with the CMSRepeater control?

Thanks.

User avatar
Guest
admin - 4/8/2005 7:15:13 PM
   
Re: Paging
Unfortunately, the CMSRepeater control does not support paging. However, you could do this:

1) Use CMSDataGrid control.
2) Create one column in the DataGrid designer and convert it to "templated column".
3) Specify item template for that column.
4) Set up paging for the CMSDataGrid.
5) Hide the header of the DataGrid.

Please let me know if this helps.

Best Regards,

User avatar
Member
Member
sciamannikoo - 4/9/2005 12:27:18 PM
   
Re: Paging
I've use that to page a Datalist. With this code we can page all repeaters controls (repeater, datali, datagrid too).

I write a simple description, but with few modification we can page with number pages, intevarls, etc...

First, near repeater control, add two hyperlink controls, to move to previous (htPrev) and next (htNext) page, and a text box to show current page. I've added these controls in a panel control (pnlTop) to hide all if i've only one page.

Att these field:
Public pagedData As New PagedDataSource

In Page_Load, add these two rows:
doPaging()
pnlTop.Visible = Not (GetDataSource() Is Nothing OrElse GetDataSource.Tables(0).Rows.Count = 0)

Function GetDataSource return some data (all records!!!)

This is the heart of paging:

Sub doPaging()
Dim selectionid As String = Request.Params("selection")

Dim intPage As Int32
If Request.QueryString("Page") = "" Then
intPage = 0
Else
intPage = CType(Request.QueryString("Page"), Int32)
End If

'we assing to pageddatasource full datasource
pagedData.DataSource = GetDataSource.Tables(0).DefaultView
'we active pagine e set records number to show for each page
pagedData.AllowPaging = True
pagedData.PageSize = 10
i
Try
pagedData.CurrentPageIndex = intPage
Catch ex As Exception
pagedData.CurrentPageIndex = 0
End Try

'we show previous and next control
hlTPrev.Visible = (Not pagedData.IsFirstPage) And pagedData.PageCount > 1
hlTNext.Visible = (Not pagedData.IsLastPage) And pagedData.PageCount > 1

'we show current URLs pattern
Dim strPage As String = ResolveUrl(Functions.GetAliasPath) & "?Page={0}&selection={1}"

'we set buttons URLs
hlTPrev.NavigateUrl = String.Format(strPage, (pagedData.CurrentPageIndex - 1), Request.Params("selection"))
hlTNext.NavigateUrl = String.Format(strPage, (pagedData.CurrentPageIndex + 1), Request.Params("selection"))

'we get current page numer a count
pageTNumber.Text = "Page " & (pagedData.CurrentPageIndex + 1) & " of " & pagedData.PageCount
pageTNumber.Visible = (pagedData.PageCount > 1)

'we conntect datasource to control
Me.CMSDataList2.DataSource = pagedData
Me.CMSDataList2.DataBind()
End Sub


Bye,
Andrea

User avatar
Guest
admin - 4/11/2005 7:18:07 PM
   
Re: Paging
Thank you for this useful post, Andrea!

User avatar
Member
Member
wahid - 4/26/2005 6:13:10 AM
   
Re: Paging
Big thanks for your help guys!

User avatar
Member
Member
MRB - 11/6/2006 10:04:34 PM
   
Re: Paging
Hi Thanks for those reply!

I have the same problem.
I need to use Repeater control with Datagrid for paging.

Can anyone pls clarify me as what is the functionality of the function GetDataSource ?
if its a custom function,then how can we get all the records from queryRepeater and dispaly it in the Datagrid ?

Thanks for ur help.
Regards,
MRB

User avatar
Guest
admin - 11/9/2006 1:42:15 PM
   
Re: Paging
Hello,

you need to use either TreeProvider.SelectNodes method to retrieve documents or GeneralConnection.ExecuteQuery to execute custom query (defined in document type queries). It will return a DataSet that needs to be assigned to PagedDataSource.

Best Regards,