views:

200

answers:

0

I am using a ListView and DataPager on a page that is url rewritten. It works fine using PostBacks, but if I use the QueryStringField property, the URL's that are generated by the DataPager do not display the "friendly" URL, but the path to the actual page it is on. So if I have the DataPager on a page with a URL of: http://www.url.com/page.aspx, but the code is actually on a page called /Templates/PageTemplate.aspx in my project, the URL will look like this:

PostBack: http://www.url.com/page.aspx?pageNumber=1 (good)

QueryString: http://www.url.com/Templates/PageTemplate.aspx?pageNumber=1 (not good)

This is the code I'm using:

<asp:DataPager ID="dpPager" runat="server" PagedControlID="lvOutput" QueryStringField="pageNumber">
    <Fields>
        <asp:NumericPagerField NextPageText="Next" PreviousPageText="Previous" />
    </Fields>
</asp:DataPager>

<asp:ListView ID="lvOutput" runat="server" OnPagePropertiesChanged="lvOutput_PagePropertiesChanged">
    <LayoutTemplate>
        <asp:PlaceHolder id="itemPlaceholder" runat="server" />
    </LayoutTemplate>    
    <ItemTemplate>
        <a href="<%# Eval("Link") %>" title="<%# Eval("Title") %>"><%# Eval("Title") %></a>
    </ItemTemplate>
    <EmptyDataTemplate>
        No Results Found
    </EmptyDataTemplate>
</asp:ListView>