根据语言会话引导程序更改Div位置

时间:2016-12-11 11:17:25

标签: javascript jquery html css asp.net

///////// Div Detail

<div class="col-md-6 col-sm-6 col-xs-12 profile_left">
  <ul class="list-unstyled user_data">
    <li>
      <i class="fa fa-map-marker user-profile-icon voilet"></i>
      <asp:Label ID="lblArea" runat="server" Text="Area"></asp:Label>
      <asp:Label ID="lblBlock" runat="server" Text="Area"></asp:Label>
    </li>
    <li>
      <i class="fa fa-location-arrow user-profile-icon voilet"></i>Street
      <asp:Label ID="lblStreet" runat="server" Text="-"></asp:Label>, Building
      <asp:Label ID="lblBuilding" runat="server" Text="--"></asp:Label>, Floor
      <asp:Label ID="lblFloor" runat="server" Text="Floor"></asp:Label>, Flat
      <asp:Label ID="lblflat" runat="server" Text="Flat"></asp:Label>
    </li>
    <li>
      <i class="fa fa-mobile user-profile-icon voilet"></i>
      <asp:Label ID="lblMobile1" runat="server" Text="Mobile1"></asp:Label>-
      <asp:Label ID="lblMobile2" runat="server" Text="Mobile2"></asp:Label>
    </li>
    <li>
      <i class="fa fa-envelope-o user-profile-icon voilet"></i>
      <asp:Label ID="lblEmail" runat="server" Text="EmailAddress"></asp:Label>
    </li>
    <li>
      <i class="fa fa-briefcase user-profile-icon voilet"></i>
      <asp:Label ID="lblcompany" runat="server" Text="Company"></asp:Label>
    </li>
  </ul>
</div>

<div class="col-md-6 col-sm-6 col-xs-12">
  <div class="animated flipInY tile-stats" style="background: #d9534f; color: #ffffff;">
    <div class="count">
      <asp:Label ID="lblbalance" runat="server" Text=""></asp:Label>
    </div>
    <p>BALANCE</p>
  </div>

  <asp:LinkButton runat="server" ID="btncallme" class="btn btn-success btn-lg" Style="width: 100%;"
                                    OnClientClick="return confirm('Are you sure you want to Request Call Back?');"
                                    OnClick="btncallme_Click">
    <i class="fa fa-mobile m-right-xs"></i> Call Me Back
  </asp:LinkButton>
  <asp:LinkButton runat="server" ID="btnpickup" OnClientClick="return confirm('Are you sure you want to Request Pickup?');"
                                    class="btn btn-warning btn-lg" Style="width: 100%;" OnClick="btnpickup_Click">
    <i class="fa fa-rocket m-right-xs"></i> Pickup My Stuff
  </asp:LinkButton>
  <asp:LinkButton runat="server" ID="btnaddbalance" class="btn btn-primary btn-lg" Style="width: 100%;">
    <i class="fa fa-plus m-right-xs"></i> Add Balance
  </asp:LinkButton>
  <asp:LinkButton runat="server" ID="btneditprofile" class="btn btn-danger btn-lg" Style="width: 100%;">
    <i class="fa fa-edit m-right-xs"></i>Change Password
  </asp:LinkButton>

</div>

我有两个div,我希望根据语言英语/阿拉伯语改变位置。 如果会话是阿拉伯语,则Div操作应该在Div Detail之前,反之亦然。

Asp.net

1 个答案:

答案 0 :(得分:0)

这里有一些可能对此有帮助的服务器端代码,尽管可能有更简洁的方法

            protected void Page_Load(object sender, EventArgs e)
            {
                int here = -1;
                for (int i = 0; i<Request.Headers.Keys.Count; i++)
                {
                    if (Request.Headers.Keys[i] == "Accept-Language")
                    {
                        here = i;
                    }
                }
                if(here > -1) {
                    String lan = Request.Headers[here];
                    if(lan == "en-US")
                    {
                    // do this
                    }
                    else
                    {
                    // do that
                    }
                }
                else {
                    // do a client side solution
                }