« Previous Next »

Thread: DataPager and RewriteModule

Last post 08-03-2009 2:23 PM by ruslany. 5 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (6 items)

Sort Posts:

  • 07-22-2009, 8:12 AM

    DataPager and RewriteModule

     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?

  • 07-22-2009, 1:57 PM In reply to

    • ruslany
    • Top 25 Contributor
    • Joined on 07-01-2007, 7:38 PM
    • Redmond, WA
    • Posts 661

    Re: DataPager and RewriteModule

    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 ?

    http://ruslany.net
  • 07-22-2009, 3:14 PM In reply to

    Re: DataPager and RewriteModule

     yes, This is true

  • 07-27-2009, 2:35 PM In reply to

    • ruslany
    • Top 25 Contributor
    • Joined on 07-01-2007, 7:38 PM
    • Redmond, WA
    • Posts 661

    Re: DataPager and RewriteModule

    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>

    http://ruslany.net
  • 08-01-2009, 3:02 AM In reply to

    Re: DataPager and RewriteModule

     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

  • 08-03-2009, 2:23 PM In reply to

    • ruslany
    • Top 25 Contributor
    • Joined on 07-01-2007, 7:38 PM
    • Redmond, WA
    • Posts 661

    Re: DataPager and RewriteModule

    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/

    http://ruslany.net
Page 1 of 1 (6 items)
Microsoft Communities