This is a migrated thread and some comments may be shown as answers.

How to setup culture, right-to-left dynamically?

2 Answers 78 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Wei
Top achievements
Rank 1
Wei asked on 04 Nov 2008, 02:55 PM

In my project I need to set right to left at page load time. Is there a way to access RADControl collection on current page so I can use a general function to set all controls’ RTL property?

Here is my unsuccessful code snippet:

 

        protected void Page_Load(object sender, EventArgs e)  
        {  
            //testing Right-to-left layout for Rad Control  
            SetRControlsRightToLeftLayout(thistrue);  
 
        }  
 
        protected void SetRControlsRightToLeftLayout(Control context, bool isSetRightToLeft)  
        {  
            foreach (Control c in context.Controls)  
            {  
                Control rControl = c as Control;//RadControl rControl = c as RadControl;  
                if (rControl != null)  
                {  
                    if (rControl.GetType().ToString().StartsWith("Telerik.Web.UI",StringComparison.Ordinal))  
                    {  
                        System.Diagnostics.Debug.WriteLine(rControl.GetType());  
                    }  
                    if (rControl.HasControls())  
                    {  
                        SetRControlsRightToLeftLayout(rControl, isSetRightToLeft);  
                    }  
                }  
            }  
        } 

2 Answers, 1 is accepted

Sort by
0
Accepted
Blaize
Top achievements
Rank 1
answered on 05 Nov 2008, 09:04 AM
Hey Wei,
What about

rControl.Attributes["dir"] = "rtl";

?

Cheers,
Blaize
0
Waleed Seada
Top achievements
Rank 2
answered on 25 Nov 2009, 10:58 AM
Hello Blaize,

I can't see where to put the <rControl.Attributes["dir"] = "rtl";> in the code, I get cannot resolve symbol error message.

Best regards.
Waleed
Tags
General Discussions
Asked by
Wei
Top achievements
Rank 1
Answers by
Blaize
Top achievements
Rank 1
Waleed Seada
Top achievements
Rank 2
Share this question
or