locked
change url on same page RRS feed

  • Question

  • User1515160841 posted

    Hi. i make a site with two language. Turkish and English. i try to do this.

    for example i am in product page. my url is

    .../product/man/tshirt. in english language. when turkish language is selected  i want to change this url as ../urun/erkek/tshirt. my page controls changes correctly.(buttons'name, labels etc.) .

    i think that i must a routing module.

    anyone has any knowledge or idea?

    Thanks in advance.

    Tuesday, March 13, 2012 11:36 PM

Answers

  • User1954304945 posted

    Hi, you can set your route rules in “Global.asax”, for more information, please refer to:

    http://msdn.microsoft.com/en-us/library/cc668201.aspx

    And then, please add a DropDownList to your page, for example:

     <asp:DropDownList ID="DropDownList1" runat="server" 
                AutoPostBack="True" onselectedindexchanged="DropDownList1_SelectedIndexChanged">
                <asp:ListItem Text="Please select your language"></asp:ListItem>
                <asp:ListItem>English</asp:ListItem>
                <asp:ListItem>Turkish </asp:ListItem>
            </asp:DropDownList>
    

    In your C# codes, please add the following event handling codes:

    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
            {
                if (this.DropDownList1.SelectedIndex==1)
                {
                    Response.Redirect("product/man/tshirt");
                }
                else if (this.DropDownList1.SelectedIndex==2)
                {
                    Response.Redirect("urun/erkek/tshirt");
                }
            }
    
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 19, 2012 11:28 PM

All replies

  • User1477435862 posted

    Are you using WebForms or MVC?

    Wednesday, March 14, 2012 9:20 PM
  • User1515160841 posted

    i use webforms

    Thursday, March 15, 2012 10:14 AM
  • User1477435862 posted

    You marked the thread as answered.  Have you resolved your issue?

    Thursday, March 15, 2012 10:23 AM
  • User1515160841 posted
    no i did it wrongly. my problem continues.
    Thursday, March 15, 2012 10:46 AM
  • User1477435862 posted

    Are you able to use Routing?

    Thursday, March 15, 2012 11:48 AM
  • User1515160841 posted

    i use urlrouting on .Net 4.0

    Thursday, March 15, 2012 11:57 AM
  • User1477435862 posted

    Yes, what version are you using?

    Thursday, March 15, 2012 12:02 PM
  • User1954304945 posted

    Hi, you can set your route rules in “Global.asax”, for more information, please refer to:

    http://msdn.microsoft.com/en-us/library/cc668201.aspx

    And then, please add a DropDownList to your page, for example:

     <asp:DropDownList ID="DropDownList1" runat="server" 
                AutoPostBack="True" onselectedindexchanged="DropDownList1_SelectedIndexChanged">
                <asp:ListItem Text="Please select your language"></asp:ListItem>
                <asp:ListItem>English</asp:ListItem>
                <asp:ListItem>Turkish </asp:ListItem>
            </asp:DropDownList>
    

    In your C# codes, please add the following event handling codes:

    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
            {
                if (this.DropDownList1.SelectedIndex==1)
                {
                    Response.Redirect("product/man/tshirt");
                }
                else if (this.DropDownList1.SelectedIndex==2)
                {
                    Response.Redirect("urun/erkek/tshirt");
                }
            }
    
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 19, 2012 11:28 PM