DataPager and RewriteModule [Answered]RSS

5 replies

Last post Aug 03, 2009 02:23 PM by ruslany

  • DataPager and RewriteModule

    Jul 22, 2009 08:12 AM|sadegh-shad|LINK

     I used DataPager for moving to pages

     <asp:DataPager ID="dpSummary" class="pager" runat="server" PagedControlID="lvSummary"
    QueryStringField="page" PageSize="10">
     <Fields>
      <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowNextPageButton="False" ShowPreviousPageButton="False" />
      <asp:NumericPagerField />
      <asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" ShowNextPageButton="False" ShowPreviousPageButton="False" />
     </Fields>
    </asp:DataPager>

     and would change  news/default.aspx?page=3 to news/3.aspx by rewriteModule.

    What should I do?

    RewriteModule DataPager

  • Re: DataPager and RewriteModule

    Jul 22, 2009 01:57 PM|ruslany|LINK

    Do you mean you want users to browse to http://somesite.com/news/3.aspx and then rewrite it to http://somesite.com/news/default.aspx?page=3 ?

  • Re: DataPager and RewriteModule

    Jul 22, 2009 03:14 PM|sadegh-shad|LINK

     yes, This is true

  • Re: DataPager and RewriteModule

    Jul 27, 2009 02:35 PM|ruslany|LINK

    This can be done with a relatively simple rule:

    <rule name="news" >
                        <match url="^news/(\d+)\.aspx$"  />
                        <conditions>
                            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                        </conditions>
                        <action type="Rewrite" url="news/default.aspx?page={R:1}" />
    </rule>

  • Re: DataPager and RewriteModule

    Aug 01, 2009 03:02 AM|sadegh-shad|LINK

     thanks ruslan but this isnt my purpose.

     

    i want to change DataPager links href attribute from news.aspx?page=id to id.aspx

     

    thanks again

  • Re: DataPager and RewriteModule

    Aug 03, 2009 02:23 PM|ruslany|LINK

    Thats a more difficult task but can be done with URL rewrite 2.0 beta. You will have to create a rewrite rule that changes the href attribute in the response generated by ASP.NET control. Here is an article which explains how to do something like this: http://learn.iis.net/page.aspx/657/creating-outbound-rules-for-url-rewrite-module/