Displaying as 'Page 1' instead of '1234' in datagrid in ASP.NET

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can anyone explain me how to customize paging in Data grid? I just want to display 'Page 1 2 3 4' instead of normal '1234

Thanks
Shiva
 
Hi Shiva,

Try this?

<asp:DataGrid id="DataGrid1" runat="server" PageSize="3"
AllowPaging="True" ShowFooter="True">
<PagerStyle PageButtonCount="4" Mode="NumericPages"></PagerStyle>
</asp:DataGrid>

Private Sub DataGrid1_ItemCreated _
(ByVal sender As Object, ByVal e As _
DataGridItemEventArgs) Handles DataGrid1.ItemCreated
If e.Item.ItemType = ListItemType.Pager Then
Dim pagerCell As TableCell
pagerCell = CType(e.Item.Controls(0), TableCell)
Dim pageOf As String = _
"Choose the page you want to go: "
pagerCell.Controls.AddAt(0, _
New LiteralControl(pageOf))
End If
End Sub

Ken
Microsoft MVP [ASP.NET]
 
Back
Top