where is the problem of my code?
-
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">
-
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">
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