show IMAGE instead of Text on Root of Tree Using RadMenu

7 posts, 0 answers
  1. Suresh Kannan
    Suresh Kannan avatar
    14 posts
    Member since:
    Oct 2009

    Posted 19 Oct 2009 Link to this post

    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

      
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 19 Oct 2009 Link to this post

    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.
  3. Suresh Kannan
    Suresh Kannan avatar
    14 posts
    Member since:
    Oct 2009

    Posted 19 Oct 2009 Link to this post

    Thanks,

    I need to set this as Dynamically, it's binding data from db. suggestion plz ???
  4. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 19 Oct 2009 Link to this post

    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
  5. Suresh Kannan
    Suresh Kannan avatar
    14 posts
    Member since:
    Oct 2009

    Posted 19 Oct 2009 Link to this post

    Gr8, Thank u,

    can i set the custom skin, how to refer the skin in RadMenu / calling the .css
  6. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 20 Oct 2009 Link to this post

    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.
  7. Suresh Kannan
    Suresh Kannan avatar
    14 posts
    Member since:
    Oct 2009

    Posted 21 Oct 2009 Link to this post

    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...
Back to Top