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

show IMAGE instead of Text on Root of Tree Using RadMenu

6 Answers 115 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Suresh Kannan
Top achievements
Rank 1
Suresh Kannan asked on 19 Oct 2009, 06:20 AM
Hi,

   I want to show the IMAGE instead of "Text" in ROOT Item of the RadMenu...

[Image] in Root - if i click , will show the Items....


If any one can suggest me will be more apprict...


Thanks & Regards,
Suresh Kannan P

  

6 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 19 Oct 2009, 07:09 AM
Hi Suresh,

Set the image using ImageUrl property of root items in order to show images for root items.

aspx:
 
<telerik:RadMenu ID="RadMenu1" runat="server" ClickToOpen="true"
    <Items> 
        <telerik:RadMenuItem runat="server" ImageUrl="../Images/Image1.gif">                         
        </telerik:RadMenuItem> 
        <telerik:RadMenuItem runat="server" ImageUrl="../Images/Image2.gif"
            <Items> 
                <telerik:RadMenuItem runat="server" Text="Child1"
                </telerik:RadMenuItem> 
                <telerik:RadMenuItem runat="server" Text="Child2"
                </telerik:RadMenuItem> 
            </Items> 
        </telerik:RadMenuItem>                     
    </Items> 
</telerik:RadMenu> 
And set the ClickToOpen property to True which indicates whether root items should open on mouse click.

-Shinu.
0
Suresh Kannan
Top achievements
Rank 1
answered on 19 Oct 2009, 09:11 AM
Thanks,

I need to set this as Dynamically, it's binding data from db. suggestion plz ???
0
Princy
Top achievements
Rank 2
answered on 19 Oct 2009, 10:26 AM
Hello,

Try out the following code snippet for setting ImageUrl for root items in ItemDataBound event.

cs:
 
protected void RadMenu1_ItemDataBound(object sender, RadMenuEventArgs e) 
{         
    RadMenuItem item = (RadMenuItem)e.Item; 
    if (item.Level == 0) 
    { 
        DataRowView rowView = (DataRowView)e.Item.DataItem; 
        String str = rowView["imageurl"].ToString(); 
        item.ImageUrl = str; 
        item.Text = ""
    }  
[I guess you are saving the imageurl in db]



Thanks,
Princy
0
Suresh Kannan
Top achievements
Rank 1
answered on 19 Oct 2009, 10:50 AM
Gr8, Thank u,

can i set the custom skin, how to refer the skin in RadMenu / calling the .css
0
Shinu
Top achievements
Rank 2
answered on 20 Oct 2009, 05:41 AM
Hi Suresh Kannan,

RadMenu allows creating a custom RadMenu skin. I hope the following links would be of help in refering skin files for RadMenu.
Tutorial: Creating A Custom Skin
Understanding the Skin CSS File
CSS Skin File Selectors

-Shinu.
0
Suresh Kannan
Top achievements
Rank 1
answered on 21 Oct 2009, 06:51 AM
Thanks, Nice links..


added the root item as IMAGE with custom skin..fine. but the Root Item of Image is not align properly..there is some blank spaces are there in the root item, because of clear the root item when itemdatabound. if i move the mouse on the blank also show the submenus as well as image move. Left side blank i.e control text(empty) want to remove..

Plz find the attached (see the left side blank)..

any idea...
Tags
Menu
Asked by
Suresh Kannan
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Suresh Kannan
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or