2013-06-26 4 views
0

가정하자 나는 ProductList.aspx 다음과 같은 하이퍼 링크asp.net 언어 변경

http://localhost:7621/PDWv1.0.4/ProductList.aspx?categoryID=2 

및 페이지로드와 하위 페이지가 (를 Page_Load 섹션)

if (!Page.IsPostBack) 
    { 
     l_categoryParseId = Request.QueryString["categoryID"]; 
     if (l_categoryParseId == null || l_categoryParseId.Trim() == null || 
      l_categoryParseId == "" || l_categoryParseId.Trim() == "") 
     { 
      l_productlist = l_access.getProductList(-1, lang); 
     } 
     else 
     { 
      int categoryID = Int32.Parse(l_categoryParseId.ToString()); 
      l_productlist = l_access.getProductList(categoryID, lang); 
     } 

     for (int i = 0; i < l_productlist.Rows.Count; i++) 
     { 
      String path = "http://www.newrising.com.hk"; 
      String httpPath = path + l_productlist.Rows[i]["productPhoto"].ToString(); 
      l_productlist.Rows[i]["productPhoto"] = httpPath; 
     } 

     listViewProductList.DataSource = l_productlist; 
     listViewProductList.DataBind(); 

     // GridViewProductList.DataSource = l_productlist; 
     //GridViewProductList.PageSize = 10; 
     //GridViewProductList.AllowPaging = true; 
     //GridViewProductList.RowCommand += new GridViewCommandEventHandler(GridViewProductList_ItemCommand); 
     //GridViewProductList.DataBind(); 
    } 
을 다음과

그리고 masterpage에 대한 하이퍼 링크 변경 panguages ​​:

MasterPage.aspx

 <asp:HyperLink ID="linkChi" runat="Server"       
         ImageUrl="images/chinese.png" /> 
        <asp:HyperLink ID="linkEng" runat="Server"       
         ImageUrl="images/english.png" /> 

MasterPage.aspx.cs 나는 언어를 전환 할 linkChi 또는 linkEng을 누를 때마다

linkChi.NavigateUrl = "?currentculture=zh-hk"; 
linkEng.NavigateUrl = "?currentculture=en-us"; 

, 그것은

가 어떻게 값을 확인 말해 주시겠습니까 .. 빈 페이지가 보여줍니다 categoryID는 페이지 포스트 백에서 유지 될 수 있습니까?

답변

1

내가 할 문제가 있지만 후 다시 후 값을 유지하는 방법을 요구하는 경우, 당신은 항상 내가 하이퍼 링크를 누르면 언어를 변경하려고

ViewState["categoryID"] = categoryID; 
+0

을 사용할 수 있습니다 무엇을 얻을 수 없습니다 –