GridView分页更改URL

时间:2014-01-02 16:01:59

标签: asp.net sql-server vb.net gridview url-rewriting

我正在使用GridView从我的MSSQL DB中显示一组记录(汽车)。我也在同一页面上使用URL重写。

页面的实际名称(包括查询字符串)将为 Range.aspx?name = a1 ,并将其重写为 site.com/range/a1 /

我遇到的问题是,当我尝试浏览GridView中的记录时,网址会更改为 site.com/range/a1/?name=a1 ,这会打破URL重写,反过来使GridView认为没有数据可以显示。

这是我在Web.Config文件中使用的URL重写:

<rule name="rwRangeResults" stopProcessing="true">
  <match url="^range/([^/]+)/?$"/>
  <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
  </conditions>
  <action type="Rewrite" url="/Range.aspx?name={R:1}"/>
</rule>

我不确定这是否是我重写的错误,或者我是否需要使用GridView来阻止它更改URL。任何帮助将不胜感激。

0 个答案:

没有答案