2014-01-24 5 views
0

DataPager 컨트롤과 연결된 ListView 컨트롤이 포함 된 목록 페이지가 있습니다. ASP.Net WebForms URL routing도 구현했습니다. 사용자가 페이지를 방문 처음 할 때 내가 DataPager 페이지 버튼을 클릭하면 URL은 내가 내가를 얻을 수있는 DataPager_PagePropertiesChanging 이벤트를 처리 한데이터 페이지 페이지 인덱스 변경시 특정 경로로 리디렉션

www.domain.com/entity/list/{Page_Number} 

처럼 내가 URL이 원하는

www.domain.com/entity/list 

처럼 온다

protected void lvRestaurants_PagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e) 
    { 
     CurrentPage = ((RestaurantPager.StartRowIndex)/RestaurantPager.MaximumRows) + 1; 
     //Response.RedirectToRoute("browserestaurantbypage", new { id_pg = CurrentPage }); 
     //RestaurantPager.GetRouteUrl("browserestaurantbypage", new { id_pg = CurrentPage - 1 }); 
     Response.RedirectToRoute("browserestaurantbypage", new { id_pg = CurrentPage}); 

    } 

을 다음과 같이 현재 페이지의 색인은 확인 위의 경우에 Response.RedirectToRoute를 호출하는 것입니다 내가 때문에 페이지가 파이어 폭스에서 제대로 리다이렉트하지 못한다.

내있는 DataPager 컨트롤이를 달성하는 방법을 당신이 나를 인도 해주십시오 것

<asp:DataPager ID="RestaurantPager" runat="server" QueryStringField='<%#Eval("ID_Restaurant") %>' 
           PagedControlID="lvRestaurants" PageSize="10"> 
           <Fields> 

            <asp:NextPreviousPagerField PreviousPageText="&laquo; previous" ShowFirstPageButton="false" 
             ShowNextPageButton="False" ShowPreviousPageButton="true" /> 
            <asp:NumericPagerField ButtonType="Link" CurrentPageLabelCssClass="current" ButtonCount="4" /> 
            <asp:NextPreviousPagerField NextPageText="Next &raquo;" ShowLastPageButton="false" 
             ShowNextPageButton="true" ShowPreviousPageButton="False" /> 
           </Fields> 
          </asp:DataPager> 

를 다음과 같습니다. 문의 사항이 명확하지 않은 경우 알려 주시기 바랍니다.

답변

0

Response.Redirect ("www.domain.com/entity/whateverpage.aspx?pageNum="+ GetDestinationPageNumberFunction());

+0

나는 쿼리 문자열을 사용하지 않고 라우팅 된 URL을 원합니다. – Devjosh

+0

세션 변수로 리디렉션하십시오. –

관련 문제