Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
3.40/5 (2 votes)
Hi,

I am developing an application for English, Spanish , Chinese & Arabic language. Now for other cultures it is ok. But for Arabic language I need to swap the position of Label & textbox control dynamically.

For an example:

The Label1 & textbox1 is lying on the screen as follows for all other language --

<Label1>(On the Left) & Textbox1(On the right)

But for Arabic the position should be as follows

Textbox1(On the Left) <Label1>(On the right) with the text direction and alignment from right -> left .

Any idea how to do it in asp.net as well as in ext.net
Posted
Updated 25-Jan-14 20:49pm
v2

You need not.
Every recent - and decent - browser switches it's origin when you set direction of your page.
So create some css rules for right-to-left and left-to-right languages and use them according your needs...
 
Share this answer
 
Hi!
I think this might be helpful for you because I am Arabic! :)

you can get the user's culture using this line of code:
C#
string _userCulture = System.Threading.Thread.CurrentThread.CurrentCulture.Name;

now, for Arabic user _userCulture value will be "ar-<somthing>", (e.g.. "ar-ae" for UAE users) use this value to link a CSS file for Arabic users to your master page.

in the css file: add

CSS
body{direction: rtl;}/*this will effect everything*/


in the other side, in your html use a table to hold your controls or simply for the controls add this class in the CSS file:

CSS
selector{
display: inline;/*or inline-block without using float*/
}


and the browser will render it correctly for you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900