I am doing a search webpage that brings a lot of information from MSSQL. I made a stored procedure that only returns the page that will be displayed on the website.
I'm working on paging right now, because I need to show something similar than Google. If you are on page 1, they show the first 10 pages, and if you are on page 19, they are displayed from pages 9 to 28.
I think the best way to show page numbers is to use the link button inside the repeater. The problem that I am facing right now is that I do not know how best to take the page number when posting back.
As a quick sample, I assigned an ArrayList to repater.datasource:
<asp:Repeater ID="Repeater2" runat="server"> <ItemTemplate> <asp:LinkButton ID="LinkButton1" runat="server" CommandArgument="<%# Container.DataItem %>"><%# Container.DataItem %></asp:LinkButton> </ItemTemplate> </asp:Repeater> <asp:LinkButton ID="LinkButton2" runat="server" CommandArgument="4654">Test #1</asp:LinkButton>
In my Default.aspx.cs file, I have the following code
protected void Page_Load(object sender, EventArgs e) { if (this.IsPostBack) { string x = LinkButton2.CommandArgument;
What should I do to make this work?
Does anyone have a better solution for this search call?
thanks
Jerry
Gerardo abdo
source share