Reputation: 11
My current situation here is that when I press one of the link buttons, I can accurately jump out of the information on the page I want, but the pagination below has not changed, so we have no way to know which page we are on now.
code in aspx file
<asp:Repeater ID="rptPaging" runat="server" OnItemCommand="rptPaging_ItemCommand" >
<ItemTemplate>
<asp:LinkButton ID="lnkPage" CssClass="btnPage" OnClientClick="JavaScript: return false;"
CommandName="Page" CommandArgument="<%# Container.DataItem %>" runat="server" Font-Bold="True"><%# Container.DataItem %>
</asp:LinkButton>
</ItemTemplate>
</asp:Repeater>
Code behind. this contains the current page number.
public int PageNumber
{
get
{
if (ViewState["PageNumber"] != null)
{
return Convert.ToInt32(ViewState["PageNumber"]);
}
else
{
return 0;
}
}
set { ViewState["PageNumber"] = value; }
}
private int iPageSize = 50;
I found a way to prevent the buttons from being postback refresh css together on the Internet that is using OnClientClick to return false. Although I succeeded in making the button maintain the color after it was pressed, BUT my page was also maintained on the first page, and no matter how I pressed the paging button, it Will not jump out the data.Well, and also no any postback happen to refresh. (PS: My page is always refreshed on the same page and will not open a new page) and the paginate is using PagedDataSource.
example href for paging num1 & 2 at html
href ="javascript:__doPostBack('rptPaging$ctl00$lnkPage','')"
href="javascript:__doPostBack('rptPaging$ctl01$lnkPage','')"
I need to maintain the back color of the link button the user clicked so the user can know which paging number they are stay on.
Upvotes: 1
Views: 350