When writing ASP.NET Web pages, the best way to make text flow from right to left is to use the dir (direction) attribute. The dir attribute is usually placed in either the html or body tag, and then controls and HTML elements on the page inherit from the specified direction.
The tag to which the dir attribute is applied affects how the page appears, as follows:
-
When the value for the dir attribute is rtl (right to left) in the html tag, the page gets the correct extended styles set. On a bidirectional-enabled system, the page displays as a right-to-left page and a vertical scrollbar appears on the left side.
-
When the value for the dir attribute is rtl (right to left) in the body tag, frames and captions do not inherit the right-to-left direction.
There are other ways to set the flow of text, including the bdo tag for bidirectional override, Unicode characters that have embedded directional information, cascading style sheets, and so on. For more information, go to the Global Development Computing Portal on Microsoft.com and search for information about authoring HTML for middle-eastern content.
To set the dir attribute in an ASP.NET Web page
-
In the
<html>
or<body>
tag, setdir
toltr
orrtl
.For example:
В Copy Code
<html dir="rtl"> <!-- Or --> <body dir="rtl" >
-
To override the default direction for individual controls, set
dir
for each control toltr
orrtl
.For example:
В Copy Code
<table dir="ltr" > <asp:TextBox dir="ltr" >