Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datagrid Paging

Status
Not open for further replies.

LauraCairns

Programmer
Jul 26, 2004
173
GB
I've got the below datagrid set-up below and Im trying to get the paging wired up. The correct numbers are coming back based on the amount on pages there should be however the on-click event of each page number isn't working. Does anyone know which event I use and what code I need to add to achieve this? Thanks for your help.

<asp:datagrid id="dgAppForms" runat="server" Width="600px" CssClass="reg" BackColor="White" DataKeyField="Id"
CellPadding="4" BorderColor="White" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
Font-Names="pages">
<AlternatingItemStyle ForeColor="#061444" BackColor="#E4E4E4"></AlternatingItemStyle>
<ItemStyle ForeColor="#061444" BackColor="#EEEEEE"></ItemStyle>
<HeaderStyle Font-Names="Verdana" Wrap="False" ForeColor="White" CssClass="regtitle2" BackColor="#0D257B"></HeaderStyle>
<FooterStyle Wrap="False" ForeColor="White"></FooterStyle>
<Columns>
<asp:BoundColumn Visible="False" DataField="Id" HeaderText="VacancyChangeID">
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle"></ItemStyle>
<FooterStyle Wrap="False"></FooterStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="FileName" SortExpression="AppFormName" ReadOnly="True" HeaderText="Application Form Name">
<HeaderStyle Font-Bold="True" HorizontalAlign="Center" CssClass="regtitle" VerticalAlign="Middle"></HeaderStyle>
<ItemStyle HorizontalAlign="Left" VerticalAlign="Middle"></ItemStyle>
<FooterStyle Wrap="False"></FooterStyle>
</asp:BoundColumn>
</Columns>
<PagerStyle VerticalAlign="Middle" HorizontalAlign="Center" ForeColor="White" BackColor="#0D257B"
Wrap="False" Mode="NumericPages"></PagerStyle>
</asp:datagrid>
 
Code:
private void dgAppForms_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
	dgAppForms.CurrentPageIndex = e.NewPageIndex;
	BindGrid();
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top