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(this, true); |
} |
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); |
} |
} |
} |
} |