title: how to set html tag dir attribute from rtl to ltr and vice versa programmatically in c sharp
body: <p>I'm trying to build a multilingual web site on asp.net and i need to set html tag dir attribute from rtl to ltr and vice versa programmatically in c sharp.
  For now i have 3 languages english, hebrew and russian and i need to switch between them.
  I need to change direction of a site every time i change from ltr to rtl language and from rtl to ltr language 
  here the example of my masterpage
  please help me </p>
  
  <pre><code>&lt;%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs"     Inherits="MasterPage" %&gt;
  
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head runat="server"&gt;
  &lt;title&gt;&lt;/title&gt;
  &lt;link href="CSS/Site-RTL.css" rel="stylesheet" type="text/css" /&gt;
  &lt;/head&gt;
  &lt;body id="html" runat="server"&gt;
  &lt;form id="theForm" runat="server"&gt;
  &lt;div&gt;
      &lt;asp:ContentPlaceHolder ID="ContentPlaceHolder" runat="server"&gt;
      &lt;/asp:ContentPlaceHolder&gt;
  &lt;/div&gt;
  &lt;div style="margin-top: 20px;"&gt;
      &lt;asp:LinkButton ID="btnSetEnglish" runat="server" Text="English" CommandArgument="en-GB"
          OnClick="RequestLanguageChange_Click"&gt;&lt;/asp:LinkButton&gt;&amp;nbsp;&amp;nbsp;
      &lt;asp:LinkButton ID="btnSetHebrew" runat="server" Text="Hebrew" CommandArgument="he-IL"
          OnClick="RequestLanguageChange_Click"&gt;&lt;/asp:LinkButton&gt;&amp;nbsp;&amp;nbsp;
      &lt;asp:LinkButton ID="btnSetRussian" runat="server" Text="Russian" CommandArgument="ru-RU"
          OnClick="RequestLanguageChange_Click"&gt;&lt;/asp:LinkButton&gt;&amp;nbsp;&amp;nbsp;
  &lt;/div&gt;
  &lt;div&gt;
      &lt;asp:SiteMapDataSource ID="smdsMaster" runat="server" OnDataBinding="Page_Load" /&gt;
      &lt;asp:Menu ID="MenuMaster" runat="server" CssClass="menu" DataSourceID="smdsMaster"
          Orientation="Horizontal" StaticDisplayLevels="2" StaticSubMenuIndent="16px" MaximumDynamicDisplayLevels="1"&gt;
          &lt;DataBindings&gt;
              &lt;asp:MenuItemBinding DataMember="SiteMapNode" NavigateUrlField="Url" /&gt;
          &lt;/DataBindings&gt;
      &lt;/asp:Menu&gt;
      &lt;asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"&gt;
      &lt;/asp:ContentPlaceHolder&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>
  </p>
  
  <p>here a code behind a master page</p>
  
  <pre><code>using System;
  using System.Data;
  using System.Configuration;
  using System.Collections;
  using System.Web;
  using System.Web.Security;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  using System.Web.UI.WebControls.WebParts;
  using System.Web.UI.HtmlControls;
  using Localization.Classes;
  
  public partial class MasterPage : System.Web.UI.MasterPage
  {
  
  protected void Page_Load(object sender, EventArgs e)
  {
  
  
  }
  
  protected void RequestLanguageChange_Click(object sender, EventArgs e)
  {
      LinkButton senderLink = sender as LinkButton;
  
      //store requested language as new culture in the session
      if (senderLink.CommandArgument == "he-IL")
      {
          // some code
      }
      else
      {
          // some code
      }
      Session[Global.SESSION_KEY_CULTURE] = senderLink.CommandArgument;
  
      //reload last requested page with new culture
      Server.Transfer(Request.Path);
  
  }
  }
  </code></pre>