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

How to get RadSeachbox.SearchContext object

1 Answer 99 Views
SearchBox
This is a migrated thread and some comments may be shown as answers.
steve
Top achievements
Rank 2
steve asked on 28 Apr 2017, 05:25 PM

I'm struggling with trying to get to the SearchContext item for a radsearchbox via the client side.  below I have what I'm trying to get to, but to no avail. If some guidance could be provided I would greatly appreciate it.

 

 

function onCheckboxChanging(sender, args) {
    var chkbxlId = sender.get_id();
    var srchbxId = chkbxlId.replaceAll("radchkbox_Item", "radsearch_Item");
 
    var objSearchBox = $find(srchbxId);
    var objSearchContext = objSearchBox.get_searchContext();
 
    alert( 'SearchBox Context Item Value = ' + objSearchContext.value);
 
 
}

1 Answer, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 02 May 2017, 08:37 AM
Hi Steve,

The searchContext object does not expose a value property, doe to the fact it supports multiple items. If you want to get reference tot he currently selected item you can use the get_selectedMethod() of the search context:
http://docs.telerik.com/devtools/aspnet-ajax/controls/searchbox/client-side-programming/searchcontext-object


You can also find useful information in the following resources:
http://demos.telerik.com/aspnet-ajax/searchbox/examples/search-context/defaultcs.aspx

http://docs.telerik.com/devtools/aspnet-ajax/controls/searchbox/client-side-programming/searchcontextitem-object



Regards,
Vessy
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
SearchBox
Asked by
steve
Top achievements
Rank 2
Answers by
Vessy
Telerik team
Share this question
or