![]() |
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. |
Re: Dynamically switch page direction
I guess you should do exactly the same.
<HTML dir="<%=Session["dir"]%> Notice square brackets instead of round ones. George. "mohdowais" <mohdowais@discussions.microsoft.com> wrote in message news:F10F278A-5CC4-4C52-98EE-3ED545E0AC82@microsoft.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. |
Re: Dynamically switch page direction
On Thu, 10 Jun 2004 11:11:01 -0700, mohdowais
<mohdowais@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 |
Re: Dynamically switch page direction
<html id=html runat=server>
html.Attributes["dir"] = Session["dir"]; -- bruce (sqlwork.com) "mohdowais" <mohdowais@discussions.microsoft.com> wrote in message news:F10F278A-5CC4-4C52-98EE-3ED545E0AC82@microsoft.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. |
Re: Dynamically switch page direction
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" <mohdowais@discussions.microsoft.com> wrote in message > news:F10F278A-5CC4-4C52-98EE-3ED545E0AC82@microsoft.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. > > > |
| All times are GMT. The time now is 03:36 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.