There are a problem regarding to navigation and history point for me.
The needdatasource seems to be called prior than scriptmanager's Navigate event, thus when i addhistorypoint when changing page, view detail, and click the back button, it will reload twice and start with page 0 then the previous page.
any suggestions?
The design of grid as follows
<telerik:RadGrid SkinID="GridSkin" ID="AListingsGrid" runat="server" AllowPaging="True" |
AutoGenerateColumns="False" GridLines="None" AllowSorting="True" PageSize="10" |
ShowStatusBar="True" AllowCustomPaging="True" ShowHeader="false" ShowDesignTimeSmartTagMessage="False" |
EnableViewState="False"> |
<headercontextmenu enabletheming="True"> |
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
</headercontextmenu> |
<pagerstyle alwaysvisible="false" mode="NextPrevAndNumeric" seopagingquerystringkey="CurrentPage" /> |
<mastertableview allowcustomsorting="True" cellspacing="-1" enableviewstate="False"> |
<SortExpressions> |
</SortExpressions> |
<Columns> |
<telerik:GridTemplateColumn UniqueName="Image"> |
<ItemTemplate> |
<asp:Panel ID="PanelListings" runat="server" CssClass="display"> |
<div class="PImg"> |
<asp:HyperLink ID="lnkImghyper" runat="server"> |
<div class="ListingImg"> |
<div class="propertyImg"> |
<asp:Image ID="ImageListingPhoto" runat="server" /> |
</div> |
<asp:Image CssClass="PSoldImg" ID="imgSold" runat="server" ImageUrl="~/Images/sold.gif" |
Visible="false" /> |
</div> |
</asp:HyperLink> |
</div> |
<div id="PropertyInfo"> |
<span class="price"> |
<asp:Label ID="LblPrice" runat="server" Text="Label"></asp:Label></span> <span class="PropertyAdd"> |
<asp:HyperLink ID="lnkGridSuburb" runat="server" Font-Bold="true"></asp:HyperLink> |
</span> |
<br class="clear" /> |
<asp:Label ID="lblAddress" CssClass="lstAddress" runat="server"></asp:Label> |
<div class="adCopyTitle"> |
<asp:HyperLink ID="lnkAd" runat="server" Font-Bold="true"></asp:HyperLink> |
</div> |
<table class="listingsIcon"> |
<tr> |
<asp:Panel runat="server" ID="pnlBed"> |
<td> |
<asp:Label runat="server" ID="lblbed"></asp:Label> |
<asp:Image ID="Image6" runat="server" ImageUrl="~/Images/Stock/ADBed.png" alt="" |
CssClass="propertiesIcon" /> |
</td> |
</asp:Panel> |
<asp:Panel runat="server" ID="pnlBath"> |
<td> |
<asp:Label runat="server" ID="lblShower"></asp:Label> |
<asp:Image ID="Image5" runat="server" ImageUrl="~/Images/Stock/ADBath.png" alt="" |
CssClass="propertiesIcon" /> |
</td> |
</asp:Panel> |
<asp:Panel ID="pnlStudy" runat="server"> |
<td> |
<asp:Label ID="lblStudy" runat="server" Text=""></asp:Label> |
<asp:Image ID="Image11" runat="server" ImageUrl="~/Images/Stock/ADStudy.png" alt="" |
CssClass="propertiesIcon" /> |
</td> |
</asp:Panel> |
<asp:Panel ID="PnlLivingIcon" runat="server" Visible="false"> |
<td> |
<asp:Label ID="LblCountLivingRoom" runat="server"></asp:Label> |
<asp:Image ID="Image4" runat="server" ImageUrl="~/Images/Stock/ADLounge.png" alt="" |
CssClass="propertiesIcon" /> |
</td> |
</asp:Panel> |
<asp:Panel ID="pnlshowArea" runat="server"> |
<td> |
<asp:Label ID="lblshowArea" runat="server"></asp:Label> |
<asp:Image ID="Image12" runat="server" ImageUrl="~/Images/Stock/ADArea.png" alt="" |
CssClass="propertiesIcon" /> |
</td> |
</asp:Panel> |
<asp:Panel ID="PnlGarageIcon" runat="server"> |
<td> |
<asp:Label ID="LblCountGarage" runat="server"></asp:Label> |
<asp:Image ID="Image3" runat="server" ImageUrl="~/Images/Stock/ADGarage.png" alt="" |
CssClass="propertiesIcon" /> |
</td> |
</asp:Panel> |
<asp:Panel ID="PnlPoolIcon" runat="server"> |
<td> |
<asp:Label ID="LblCountPool" runat="server"></asp:Label> |
<asp:Image ID="Image2" runat="server" ImageUrl="~/Images/Stock/ADPool.png" alt="" |
CssClass="propertiesIcon" /> |
</td> |
</asp:Panel> |
<asp:Panel ID="PnlAirconIcon" runat="server" Visible="false"> |
<td> |
<asp:Label ID="LblCountAircon" runat="server"></asp:Label> |
<asp:Image ID="Image1" runat="server" ImageUrl="~/Images/Stock/aircon_icon.png" Width="30" |
alt="" CssClass="propertiesIcon" /> |
</td> |
</asp:Panel> |
</tr> |
</table> |
<div class="Pdetail"> |
<asp:Label CssClass="Pdetail" ID="lnkDetail" runat="server" /> |
</div> |
<asp:Panel ID="Panel1" runat="server" Visible="false"> |
<span class="PTitle">ID#</span> <span class="PTitle"> |
<%#Eval("Href_No")%></span></asp:Panel> |
</div> |
</asp:Panel> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
</Columns> |
<EditFormSettings> |
<PopUpSettings ScrollBars="None" /> |
</EditFormSettings> |
</mastertableview> |
<clientsettings> |
<Selecting AllowRowSelect="False" /> |
<Scrolling AllowScroll="false" /> |
</clientsettings> |
<filtermenu enabletheming="True"> |
<CollapseAnimation Type="OutQuint" Duration="200" /> |
</filtermenu> |
<sortingsettings enableskinsortstyles="False" /> |
<statusbarsettings loadingtext="Loading Listings, please wait..." /> |
</telerik:RadGrid> |
and code calling
Private Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init |
'Add History handler |
Dim RadScriptManager1 = DirectCast(Me.Master.FindControl("RadScriptManager1"), RadScriptManager) |
AddHandler RadScriptManager1.Navigate, AddressOf RadScriptManager1_Navigate |
End Sub |
Private Sub AListingsGrid_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles AListingsGrid.NeedDataSource |
'Get datasource |
end sub |
Private Sub RadScriptManager1_Navigate(ByVal sender As Object, ByVal e As System.Web.UI.HistoryEventArgs) |
If Not String.IsNullOrEmpty(e.State("CurrentPage")) Then |
AListingsGrid.CurrentPageIndex = CInt(e.State("CurrentPage")) |
Else |
AListingsGrid.CurrentPageIndex = 0 |
End If |
AListingsGrid.DataSource = Nothing |
AListingsGrid.Rebind() |
end sub |
and live demo as follows
thanks