Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. where is the problem of my code?

where is the problem of my code?

Scheduled Pinned Locked Moved ASP.NET
csssysadminhelpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    strawberrysh
    wrote on last edited by
    #1

    Hi I wrote these code for changing the language of my site.the default language of site is Farsi,and i put two link button in master page for switching the language , and i have two css ,one for Farsi and one for English.when the page load and when i click on en link button ,the language change but the css doesn't change ,I don't know why? in all page except master page i wrote:

    protected override void InitializeCulture()
    {
    if (Session["lang"] != null)
    {
    string selectedlang = Session["lang"].ToString();
    UICulture = selectedlang;
    Culture = selectedlang;
    Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(selectedlang);
    Thread.CurrentThread.CurrentUICulture = new CultureInfo(selectedlang);

        }
        base.InitializeCulture();
    }
    

    in masterpage in click event of link buttons

    protected void LinkButton1_Click(object sender, EventArgs e)
    {
    Session["lang"] = "en-US";
    Server.Transfer(Request.Url.PathAndQuery, false);
    type='text/css' />";

    }
    protected void LinkButton2\_Click(object sender, EventArgs e)
    {
        Session\["lang"\] = "fa-IR";
        Server.Transfer(Request.Url.PathAndQuery, false);
       type='text/css' />";
    }
    

    and in page load of master page:

    protected void Page_Load(object sender, EventArgs e)
    {
    if (!IsPostBack)
    {
    if (Session["lang"] == null)
    {

                this.Literal1.Text = "";
            }
            else
                if (Session\["lang"\].ToString() == "en-US")
                {
                    this.Literal1.Text = "";
                }
                else
                    if (Session\["lang"\].ToString() == "fa-IR")
                    {
                        this.Literal1.Text = "";
                    }
        }
    

    asp:Literal ID="Literal1" runat="server">

    S 1 Reply Last reply
    0
    • S strawberrysh

      Hi I wrote these code for changing the language of my site.the default language of site is Farsi,and i put two link button in master page for switching the language , and i have two css ,one for Farsi and one for English.when the page load and when i click on en link button ,the language change but the css doesn't change ,I don't know why? in all page except master page i wrote:

      protected override void InitializeCulture()
      {
      if (Session["lang"] != null)
      {
      string selectedlang = Session["lang"].ToString();
      UICulture = selectedlang;
      Culture = selectedlang;
      Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(selectedlang);
      Thread.CurrentThread.CurrentUICulture = new CultureInfo(selectedlang);

          }
          base.InitializeCulture();
      }
      

      in masterpage in click event of link buttons

      protected void LinkButton1_Click(object sender, EventArgs e)
      {
      Session["lang"] = "en-US";
      Server.Transfer(Request.Url.PathAndQuery, false);
      type='text/css' />";

      }
      protected void LinkButton2\_Click(object sender, EventArgs e)
      {
          Session\["lang"\] = "fa-IR";
          Server.Transfer(Request.Url.PathAndQuery, false);
         type='text/css' />";
      }
      

      and in page load of master page:

      protected void Page_Load(object sender, EventArgs e)
      {
      if (!IsPostBack)
      {
      if (Session["lang"] == null)
      {

                  this.Literal1.Text = "";
              }
              else
                  if (Session\["lang"\].ToString() == "en-US")
                  {
                      this.Literal1.Text = "";
                  }
                  else
                      if (Session\["lang"\].ToString() == "fa-IR")
                      {
                          this.Literal1.Text = "";
                      }
          }
      

      asp:Literal ID="Literal1" runat="server">

      S Offline
      S Offline
      Sandeep Akhare
      wrote on last edited by
      #2

      strawberrysh wrote:

      if (Session["lang"] == null) { this.Literal1.Text = ""; } else if (Session["lang"].ToString() == "en-US") { this.Literal1.Text = ""; } else if (Session["lang"].ToString() == "fa-IR") { this.Literal1.Text = ""; }

      Because your calling same CSS class fa.css for each condition Where is the another Css ?

      Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... " Check My Blog

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups