| Author: divya 10 Oct 2008 | Member Level: Gold | Rating:  Points: 3 |
u can set page size to 100 as pagesize="100" and then on page index changing event write the code as grid.pageindex=e.newpageindex and agai bind ur grid as u do.
|
| Author: Mari raj k 10 Oct 2008 | Member Level: Silver | Rating:  Points: 6 |
1. set property of allowpaging as true,
2. set proerty of page size = 100
3. You can configure the page to show navigation by displaying numeric values for page numbers, which is default. Or you can set Mode property of PagerSetting to one of the following values.
NextPrevious A set of pagination controls consisting of Previous and Next buttons.
NextPreviousFirstLast A set of pagination controls consisting of Previous, Next, First, and Last buttons.
Numeric A set of pagination controls consisting of numbered link buttons to access pages directly.
NumericFirstLast A set of pagination controls consisting of numbered and First and Last link buttons.
Setting Page Size From Codebehind
So far I have been talking about how to set various property values at design time or on ASPX page. There are times when you have to configure the appearance of the grid view pager based on some conditions or data value only known at run time. For those times you can take help from code behind and specify the values in the implementation code itself. For example the following code from the attached project shows the page size of the grid view is changed based on the value user specifies in the text box.
protected void OnChangePageSize(Object sender, EventArgs e) { Int32 iPageSize = ctlGridView.PageSize; if (Int32.TryParse(ctlPageSize.Text, out iPageSize)) { ctlGridView.PageSize = iPageSize; bindGridView(); } }
|
| Author: Abhay 10 Oct 2008 | Member Level: Diamond | Rating:  Points: 6 |
<asp:datagrid runat="server" cssclass="gridClass" id="dgPatient" width="389px" cellspacing="0" cellpadding="0" allowsorting="True" autogeneratecolumns="false" datakeyfield="PK_PAT_ENC_ID" showheader="true" Height="36px" PageSize="100" AllowPaging="true" OnPageIndexChanged="dgPatient_PageIndexChanged" OnItemDataBound="dgPatient_ItemDataBound" >
//--
//--
</asp:datagrid>
.aspx.cs
protected void dgPatient_PageIndexChanged(object source, DataGridPageChangedEventArgs e) { dgPatient.CurrentPageIndex = e.NewPageIndex; this.gridDatabind(); }
Thanks and Regards, Abhay
|