Passing data to context in RadAutoCompleteBox throws an error

2 posts, 0 answers
  1. Billy
    Billy avatar
    2 posts
    Member since:
    Jun 2013

    Posted 09 Dec 2013 Link to this post

    How to pass additional data to context from RadAutoCompleteBox

    This is on my markup, the retrieval of data is working but passing the data to context from the RadAutoCompleteBox has a problem.

    <telerik:RadCodeBlock runat="server">
          function TestRequesting(sender, args) {
             args.get_context()["Foo"] = "Bar";

    and this is the code in the web service

    public AutoCompleteBoxData SearchTest(RadAutoCompleteContext context)
       string searchString = context.Text;
       string foo = context["Foo"].ToString();

    the problem is in the WebMethod, the context["Foo"] throws an error that

    The given key was not present in the dictionary.

    Any help would be appreciated.. Thanks in advance.

  2. Bozhidar
    Bozhidar avatar
    1096 posts

    Posted 12 Dec 2013 Link to this post

    Hi Virgilio,

    The problem here is the name of the event - in RadAutoCompleteBox it's called OnClientRequesting. Since you are using the OnClientItemsRequesting name, the event it never triggered and the "Foo" key is not added to the dictionary.

    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 RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  3. DevCraft R3 2016 release webinar banner
Back to Top