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

Placing a control in the menu?

7 Answers 67 Views
Menu
This is a migrated thread and some comments may be shown as answers.
sircutbreaker
Top achievements
Rank 1
sircutbreaker asked on 07 May 2009, 04:37 PM
I would like to know how to place a control in the menu.. I want to integrate a radcombobox.... sort of like you have the search bar integrated into your (telerik) navbar.

I know how to do it in photoshop :)

the skin is Black... and pretty much standard..

the combobox would be populated by a couple fields in a table.. (but I have all the data streams worked out) i just need to know how to seamlessly place a radcombobox on the right side inside of a radmenu strip, regardless of there only being 2 or 3 items in the menu...

here is a link to the site where the menu is... you will see that there is only 1 item in the menu.. and the menu stretches to the width of the page... (980px in this case)

http://giovanniscoalfirepizza.com






7 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 08 May 2009, 10:55 AM
Hello,

Please find attached a simple page demonstrating the needed approach. Download it and give it a try.

Regards,
Yana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
sircutbreaker
Top achievements
Rank 1
answered on 08 May 2009, 12:34 PM
That answers the how... at design time...

I was looking at the add templates at runtime.. (because the combobox must be populated by codebehind)

I referred to this article: http://www.telerik.com/help/aspnet-ajax/menu_menu_templates_run_time.html

But for some reason.. its not working out.. I am getting 2 comboboxes in the menu.. and no regular items..

the menu is created in codebehind.. it binds from a table.. after it binds, I want the combobox to be added.. (on the right hand side)

How can I accomplish this?

thanks!

Jeff

0
sircutbreaker
Top achievements
Rank 1
answered on 08 May 2009, 01:02 PM
The menu is populated by a table in the codebehind...

after those items are added, I would like to add the combobox and place it on the right hand side as I mentioned originally.

Here is the bit of code that binds the table to the menu...

protected void Page_Load(object sender, EventArgs e) 
    {  
                     
        
        if (!IsPostBack) 
        { 
            SiteInfo si = DataRepository.SiteInfoProvider.GetBySiteId(1); 
 
            RadMenu1.Skin = si.Skin; 
            lblLogo.Text = si.Logo; 
 
 
            RadMenu1.DataSource = GetMenu(); 
            //Establish hierarchy: 
            RadMenu1.DataFieldID = "PagesMenuID"
            RadMenu1.DataFieldParentID = "ParentID"
            //Set Text, Value, and NavigateUrl: 
            RadMenu1.DataTextField = "Name"
            RadMenu1.DataValueField = "PagesMenuID"
            RadMenu1.DataNavigateUrlField = "URL"
 
                         
            RadMenu1.DataBind(); 
 
            RadMenuItem ri = new RadMenuItem(); 
            ri.CssClass="rightAligned"
            ri.Text="test"
 
            RadMenu1.Items.Add(ri); 
 
           
        } 
         
         
 
    } 


But even when i simply added the item.. and rightAligned it, it did not show up on the right hand side...

and I did add the <style> tag with the right aligned that you gave me in the sample project.

You can see it live...

http://www.giovanniscoalfirepizza.com

I need to know how to add the combobox.. in codebehind.. after the menu items have been added... or with the items being added.. but it needs to be on the right hand side.

Thanks and Regards,

Jeff



0
Yana
Telerik team
answered on 11 May 2009, 10:37 AM
Hello Jeff,

I've modified the page to show you how to add RadComboBox dynamically, you're right - the style doesn't work, so I added new styles. Please download the attached file and try it.

Best regards,
Yana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
sircutbreaker
Top achievements
Rank 1
answered on 11 May 2009, 12:37 PM
Now that is what I was looking for!  However, I have one more question to finish the job...

If I make the combobox autopostback, how do I handle the postback?

Thanks!

Jeff
0
Accepted
Yana
Telerik team
answered on 11 May 2009, 01:43 PM
Hi Jeff,

I've attached the modified page again to demonstrate how to subscribe to SelectedIndexChanged event form code-behind.

Regards,
Yana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
sircutbreaker
Top achievements
Rank 1
answered on 11 May 2009, 03:17 PM
It works exactly as I pictured it...

I have a Profile Property that remembers a clients location.... with anonymous authentication...

and that works in conjunction with the combobox on the top right hand part of the menu.

The combobox is populated by the locations the admin puts into the system...

Once again, you have provided exactly what i needed.

Thanks again!

Jeff
Tags
Menu
Asked by
sircutbreaker
Top achievements
Rank 1
Answers by
Yana
Telerik team
sircutbreaker
Top achievements
Rank 1
Share this question
or