RadSearchBox WebMethod Client-side value

2 posts, 0 answers
  1. Gavin
    Gavin avatar
    1 posts
    Member since:
    Nov 2016

    Posted 08 Nov Link to this post

    I have a RadSearchBox that is getting it's values from a WebMethod (in the standard way from the demo), I'm then trying to get the selected value on the client side. However I do not seem to be able to retrieve it. I can get the text easy enough but not the value. Could you please advise how this is done?

     

    <telerik:RadSearchBox RenderMode="Lightweight" ID="racProp" runat="server" Width="90%"
                  HighlightFirstMatch="true"
                  EmptyMessage="[No Property Selected]"
                  Filter="Contains"
                  TextSettings-SelectionMode="Single"
                  InputType="Text"
                  MaxResultCount="10"
                  OnClientDataRequesting="OnPropertiesClientRequesting"
                  OnClientSearch="OnPropertyAdded"  DataKeyNames="Category">
          <WebServiceSettings Method="GetProperties" Path="GetProperties.aspx" />
    </telerik:RadSearchBox>
  2. Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    290 posts

    Posted 11 Nov Link to this post

    Hello Gavin,

    You could get the value of the item, when you initially select it from the RadSearchBox drop-down. You could do that by handling its OnClientSearch event:
    function OnPropertyAdded(sender, args) {
        alert("Selected value: " + args.get_value());
    }

    Note that if you click afterwords the search button (the magnifier), you will be only able to access the searched text. The reason for that is the fact that the RadSearchBox is designed to facilitate text search and not an item search.

    In case you need to search against items, I would suggest you to use the RadAutoCompleteBox control instead. Keep in mind that you will have to implement your own search button for that.

    Please, note also, that the RadSearchBox does not have ​InputType and ​TextSettings-SelectionMode properties.

    Attached you will find a simple implementation of the discussed.

    Regards,
    Veselin Tsvetanov
    Telerik by Progress
    Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top