Paging information

  • Thread starter Thread starter Ian Oldbury
  • Start date Start date
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)
 
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)
 
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
 
Back
Top