By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,665 Members | 1,900 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,665 IT Pros & Developers. It's quick & easy.

Dynamically switch page direction

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
<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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.