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

Generating an RTL RadMenu from code

5 Answers 87 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 16 Sep 2010, 05:05 PM
Summary: How do I get the RadContextMenu to function in an RTL manner when generating it from code?

I have seen many references on the forums regarding creating a RadMenu (RadContextMenu) by adding dir='rtl' to the <RadContextMenu> tab in your .aspx page.

I assume that is how the control knows how to output the proper CSS classes, i.e:
<div id="RadMenu1" class="RadMenu RadMenu_Vista RadMenu_rtl RadMenu_Vista_rtl" dir="rtl">
My ContextMenu is being generated in code via something like:
contextMenu = new RadContextMenu { EnableOverlay = true, ClickToOpen = true };

I have tried using code like the following, but the '_rtl' CSS classes are not output:
contextMenu.Attributes.Add("dir", "rtl");

What is the proper way to do this?

Thank you,
Kevin

5 Answers, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 17 Sep 2010, 03:54 PM
Hi Kevin Kalitowski,

You can set the RTL support via code-behind that way:

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

where RadContextMenu1 is the ID of the RadContextMenu. Your way is not working as by doing this it seems you are trying to add a new Custom Attribute with name "dir" which is already done by default for the control.

Hope this helps.

Regards,
Veronica Milcheva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Kevin
Top achievements
Rank 1
answered on 17 Sep 2010, 05:51 PM
I changed the code as you mentioned, but the result is the same.

contextMenu = new RadContextMenu { ID = this.ID + "rm", EnableOverlay = true, ClickToOpen = true }; 
contextMenu.Attributes["dir"] = "rtl";

After the '= new RadContextMenu()' is run there is NOT a ["dir"] item in the Attributes collection as was mentioned in your reply.  Once I do the .Attributes["dir"] = "rtl", the attribute is added to the collection.  However, whether I use Atributes.Add() or Attributes["dir"], the end result is the same.  The HTML that is output does not have the RTL css classes attached.

 

<div class="RadMenu RadMenu_Vista RadMenu_Context RadMenu_Vista_Context ">

Do you have any other suggestions?  Remember, that my RadContextMenu is NOT declared on an .aspx page, but is added to a Controls collection with some code similar to 'Controls.Add(contextMenu);'.

Thank you,
Kevin

0
Veronica
Telerik team
answered on 20 Sep 2010, 02:52 PM
Hi Kevin Kalitowski,

Where did you try to attach the context menu?

I tried to add a "dir" attribute to a RadTreeViewContextMenu and both ways are working:

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

or

contextMenu.Attributes.Add("dir", "rtl");

Could you please send me the full code so I can inspect it and help you?



Best wishes,
Veronica Milcheva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Kevin
Top achievements
Rank 1
answered on 20 Sep 2010, 02:58 PM
Unfortunately that is much, much easier said than done.  I won't be able to send any code.

Does it make any difference that I am using a RadContextMenu and not a RadTreeViewContextMenu as you mentioned, or that I am on the 2009.02.0701 release?

Thank you,
Kevin
0
Veronica
Telerik team
answered on 20 Sep 2010, 04:41 PM
Hello Kevin Kalitowski,

The RadTreeViewContextMenu is the context menu of the RadTreeView. RadContextMenu could be used by many other controls. That's why I am interested to what control you want to display a context menu. I am attaching my sample project for you to see the "RTL" support working on the RadTreeViewContextMenu. You can find it in the .zip file.

I don't think that the version makes a difference for the RTL support. I've changed the Ticket Type to "Support" so you can attach your code.

Regards,
Veronica Milcheva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Menu
Asked by
Kevin
Top achievements
Rank 1
Answers by
Veronica
Telerik team
Kevin
Top achievements
Rank 1
Share this question
or