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

[Solved] Global search/Spotlight search on several fields of a table

1 Answer 25 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Julien
Top achievements
Rank 1
Julien asked on 07 Dec 2011, 07:35 AM
Hi,

I would like to know how to create an "autocomplete" textbox in the asp.net mvc grid, allowing to do a search on all fields of an object(even non displayed columns).

I saw that: http://demos.telerik.com/aspnet-mvc/grid/customtoolbar?theme=simple But it seems to be only possible to make the search on one field.

Thank you!

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 07 Dec 2011, 09:18 AM
Hello Julien,

 You can use this example as a start and then in your controller filter the data based on what the user has typed:

        function dataBinding(args) {
            var text= $("#Customers").data("tAutoComplete").value();
            args.data = $.extend(args.data, { text: text});
        }


        [GridAction]
        public ActionResult _CustomToolBar(string text)
        {
            IEnumerable<Order> orders = GetOrders(); var result = from o in orders where o.Property1 == text || o.Property2 == text select o;
            return View(new GridModel(result));
        }

I hope this helps,
Atanas Korchev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
Grid
Asked by
Julien
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or