Mohammed
Mohammed

Reputation: 203

Can i call another css file if direction changed in asp.net

I have asp.net web application for english ltr direction. Now i need to make it also available in arabic rtl direction. I'm having LTRStyle.css and RTLStyle.css for english and arabic. If change the language how to call the RTLStyle.css file?

Upvotes: 1

Views: 155

Answers (2)

Ahm3d Said
Ahm3d Said

Reputation: 812

In your page or masterpage code behind check if Thread.CurrentThread.CurrentUICulture is 'ar' or whatever the way you are using to check the changing of the language then register a ClientScript

Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "siteCSSLink", "<link href='RTLStyle.css' rel='stylesheet' />");

Upvotes: 0

Baby
Baby

Reputation: 5092

The logic on how you can do it is just like this:

if(language == english){
    <link href="LTRStyle.css" />
}
if(language == arabic){
    <link href="RTLStyle.css" />
}

Upvotes: 2

Related Questions