473,387 Members | 1,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Dynamically switch page direction

Hi

I am fairly new to ASP.NET and I am trying to migrate an existing ASP 3.0 application to asp.Net, and I seem to have hit a roadblock (maybe I just need more coffee). The current application is bi-lingual - it supports both English and Arabic. For users who prefer Arabic, the page switches to right-to-left, we do that by simply adding a "dir='rtl'" attribute to the HTML tag. This is of course dynamically like so:

<HTML dir="<%=Session("dir")%>
....
</HTML>

How can I replicate the same functionality in ASP.NET without going into aspcompat mode? I thought it would be really easy, but I tried looking all over and I couldn't believe the Page Object does not have a RightToLeft property, or a way to edit the HTML tag generated! Surely there is an easy way to do this? Any suggestions would be welcome.
Nov 18 '05 #1
4 2293
I guess you should do exactly the same.
<HTML dir="<%=Session["dir"]%>
Notice square brackets instead of round ones.

George.
"mohdowais" <mo*******@discussions.microsoft.com> wrote in message
news:F1**********************************@microsof t.com...
Hi

I am fairly new to ASP.NET and I am trying to migrate an existing ASP 3.0 application to asp.Net, and I seem to have hit a roadblock (maybe I just
need more coffee). The current application is bi-lingual - it supports both
English and Arabic. For users who prefer Arabic, the page switches to
right-to-left, we do that by simply adding a "dir='rtl'" attribute to the
HTML tag. This is of course dynamically like so:
<HTML dir="<%=Session("dir")%>
...
</HTML>

How can I replicate the same functionality in ASP.NET without going into

aspcompat mode? I thought it would be really easy, but I tried looking all
over and I couldn't believe the Page Object does not have a RightToLeft
property, or a way to edit the HTML tag generated! Surely there is an easy
way to do this? Any suggestions would be welcome.
Nov 18 '05 #2
On Thu, 10 Jun 2004 11:11:01 -0700, mohdowais
<mo*******@discussions.microsoft.com> wrote:

<HTML dir="<%=Session("dir")%>
...
</HTML>

How can I replicate the same functionality in ASP.NET without going into
aspcompat mode? I thought it would be really easy, but I tried looking
all over and I couldn't believe the Page Object does not have a
RightToLeft property, or a way to edit the HTML tag generated! Surely
there is an easy way to do this? Any suggestions would be welcome.


If you're looking to do this conversion quickly, you can do what you were
doing there. That notation still works in ASP.NET and I don't think you
need to do aspcompat (otherwise remove the = sign and use
Response.Write("dir")

the only problem is if you're using C#, C# uses brackets for accessing
items indexed in a collection...it'd be

<HTML dir="<%=Session["dir"]%>

you could also do this in the code-behind, let me know if that's your
approach and I can show you how to do that as well (note this is the
slightly better approach as a purist, but either way will work).

Note the attribute on an HTML tag does not necessarily translate to
properties in Page class in code. You can define your own attributes in
the HTML to go into the outgoing HTML; as long as it's valid HTML of
course, it'll work correctly.

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 18 '05 #3
<html id=html runat=server>

html.Attributes["dir"] = Session["dir"];
-- bruce (sqlwork.com)

"mohdowais" <mo*******@discussions.microsoft.com> wrote in message
news:F1**********************************@microsof t.com...
Hi

I am fairly new to ASP.NET and I am trying to migrate an existing ASP 3.0 application to asp.Net, and I seem to have hit a roadblock (maybe I just
need more coffee). The current application is bi-lingual - it supports both
English and Arabic. For users who prefer Arabic, the page switches to
right-to-left, we do that by simply adding a "dir='rtl'" attribute to the
HTML tag. This is of course dynamically like so:
<HTML dir="<%=Session("dir")%>
...
</HTML>

How can I replicate the same functionality in ASP.NET without going into

aspcompat mode? I thought it would be really easy, but I tried looking all
over and I couldn't believe the Page Object does not have a RightToLeft
property, or a way to edit the HTML tag generated! Surely there is an easy
way to do this? Any suggestions would be welcome.
Nov 18 '05 #4
George, Craig, Bruce ... you guys are tops! Thanks a lot, especially Bruce. Craig, is this what you had in mind? Or is there another way?

Cheers mates!

MO

"bruce barker" wrote:
<html id=html runat=server>

html.Attributes["dir"] = Session["dir"];
-- bruce (sqlwork.com)

"mohdowais" <mo*******@discussions.microsoft.com> wrote in message
news:F1**********************************@microsof t.com...
Hi

I am fairly new to ASP.NET and I am trying to migrate an existing ASP 3.0

application to asp.Net, and I seem to have hit a roadblock (maybe I just
need more coffee). The current application is bi-lingual - it supports both
English and Arabic. For users who prefer Arabic, the page switches to
right-to-left, we do that by simply adding a "dir='rtl'" attribute to the
HTML tag. This is of course dynamically like so:

<HTML dir="<%=Session("dir")%>
...
</HTML>

How can I replicate the same functionality in ASP.NET without going into

aspcompat mode? I thought it would be really easy, but I tried looking all
over and I couldn't believe the Page Object does not have a RightToLeft
property, or a way to edit the HTML tag generated! Surely there is an easy
way to do this? Any suggestions would be welcome.

Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

35
by: Thomas Matthews | last post by:
Hi, My son is writing a program to move a character. He is using the numbers on the keypad to indicate the direction of movement: 7 8 9 4 5 6 1 2 3 Each number has a direction except...
39
by: Randell D. | last post by:
Folks, I'm sure this can be done legally, and not thru tricks of the trade - I hope someone can help. I'm writing a 'tool' (a function) which can be used generically in any of my projects. ...
8
by: Donald Xie | last post by:
Hi, I noticed an interesting effect when working with controls that are dynamically loaded. For instance, on a web form with a PlaceHolder control named ImageHolder, I dynamically add an image...
4
by: Harry | last post by:
Hello, I have a page with a RadioButtonList and a PlaceHolder control. The RadioButtonList's AutoPostBack attribute is set to TRUE and its SelectedIndexChanged event loads one of three...
5
by: Amelyan | last post by:
How can I get state of dynamically created controls (RadioButton, CheckBox, TextBox.Text) on post back when I click submit button? The only way I know is by traversing Response.Form enumberator;...
4
by: Ed Jay | last post by:
I generate a DHTML page (a medical report) with dynamically generated text based on user input (answers to questions). The page length changes dynamically. I desire that when the page is printed...
0
by: Mike Collins | last post by:
I someone can please help, I am about at an end in trying to figure this out. I am adding some dynamic controls to my page (I found out that I was supposed to be doing that in the oninit event,...
4
daJunkCollector
by: daJunkCollector | last post by:
I am using AJAX to dynamically load content into a <div> layer. As it stands, I am loading .html's into the <div> layer and it works awesome. The problem is that when I try to replace the .html...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.