Paging information

I

Ian Oldbury

Hi all,

I'm trying to use paging and also have the following placed within the
footer of the grid following on from the NumericPages information.

Page x of y

and have the "x" as a text box where the user can enter the page that they
wish to move to.

how do i create the page x of y concept, i've tried placing
<asp:templatecolumn>
<footertemplate>
<asp:label id="lblPageInfo" runat="server" cssclass="GridText
Small"></asp:label>
</footertemplate>
</asp:templatecolumn>

and then referencing this within the ITEMDATABOUND event but so far i've
been unable to gain access to the control. i also don't know if this is the
right way to do this kind of thing.

cheers ian

(numeric paging panel)
 
R

Rick Spiewak

Do this in the item created event, and make sure that the item type is
"pager". Then, you *should* be able to add your desired text onto the end
with a little experimentation. You can walk the controls with
itm.Cells(0).Controls (where itm is your datagriditem)
 
I

Ian Oldbury

thanks for that information, i'm working away at it now.

i've been able to add the textbox and labels that would make up the "Page X
of Y".
i've included the ItemCreated code

do you know how i access these controls when they've been created? as my
attempts have failed.

ian

Private Sub grdConfiguration_ItemCreated(ByVal sender As Object, ByVal e
As System.Web.UI.WebControls.DataGridItemEventArgs) Handles
grdConfiguration.ItemCreated
If e.Item.ItemType = ListItemType.Pager Then


Dim PagerTextBox As New TextBox
Dim PagerLabel As New Label

PagerLabel.ID = "lblPageInfo"
PagerLabel.Text = "Page "
e.Item.Cells(0).Controls.Add(PagerLabel)
PagerLabel = Nothing

PagerTextBox.ID = "txtCurrentPage"
PagerTextBox.Text = "3"
PagerTextBox.MaxLength = 4

PagerTextBox.CssClass = "GridTextBox Small"
e.Item.Cells(0).Controls.Add(PagerTextBox)

PagerLabel = New Label
PagerLabel.ID = "lblPageSize"
PagerLabel.Text = " of 7"
e.Item.Cells(0).Controls.Add(PagerLabel)
PagerLabel = Nothing

End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top