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

[Solved] Menu Search Box

3 Answers 155 Views
Menu
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Michel Bakker
Top achievements
Rank 1
Michel Bakker asked on 24 Nov 2009, 09:29 AM
I like the the MVC Menu, easy to use. In some websites they integrate a search box into the menu bar. I have tried to create this with the Telerik menu but I couldn't find a way. Is there a way to do this? Like a work around or is there something I should change myself like the source code of the menu?
Any suggestions or comments are welcome.

3 Answers, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 25 Nov 2009, 11:20 AM
Hello Michel,

There is currently no support for item templates. You could modify the Telerik.Web.Mvc.UI.Menu.WriteHtml method to include it in the list (after MenuStart or before MenuEnd, within a <li class="t-item t-state-default"> element).

Greetings,
Alex
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
ColinBowern
Top achievements
Rank 1
answered on 13 Aug 2010, 08:20 PM
I'd like to chime in for this one - looking to put a search box in a top nav bar.
0
David
Top achievements
Rank 1
answered on 15 Nov 2012, 10:27 AM
This can be done using JQuery.

Use the HtmlAttributes method to set a class name for the Menu item you want to be a search box, then replace the HTML with your search box when the page has loaded.

menu.Add().Text("Asset Search").HtmlAttributes(new { @class = "search-box" });

$(document).ready(

 

function () {


$(".search-box").html("<div id='SearchDiv'><input type='search' name='AssetSearch' id='SearchBox' />&nbsp;<button type='submit' class='t-button t-state-default search-button' id='Button4'>Search</button></div>" );

});

Tags
Menu
Asked by
Michel Bakker
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
ColinBowern
Top achievements
Rank 1
David
Top achievements
Rank 1
Share this question
or