SearchProvider / Custom SearchRequest / Async Search

3 posts, 1 answers
  1. Jonas Hero
    Jonas Hero avatar
    9 posts
    Member since:
    Jul 2009

    Posted 29 Jul 2010 Link to this post


    I am using the BingSearchProvider to get geodata for addresses. Simply by creating a SearchRequest an calling the SearchAsync method. What I need is some data of the request in the method linked to the SearchCompleted event.

    My first attempt was writing a custom SearchRequest class with the needed data fields, inherited from the SearchRequest class. The request works fine but i didn't find any data of the request object when code runs into the attached method.

    The second attempt was creating a new SearchProvider instance for every request and passing the needed parameters to the SearchCompleted method by binding the handler with an delegate, which lead to massive performance problems (as I thought).

    Is there any possibilty to get the SearchRequest in SearchCompletedEventArgs in the event handler method? Or perhaps, someone of you could figure out a clean pattern for such a scenario.

    I will greatly appreciate any bit of information about this topic. Thank you!

  2. Answer
    Andrey avatar
    1681 posts

    Posted 30 Jul 2010 Link to this post

    Hi Jonas Hero,

    You can use UserData property of the request for these purposes (it will be passed to the response associated with this request).  It can be used to identify request-response pair and is retrieved through the RequestUserData property of the response object.

    Andrey Murzov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Jonas Hero
    Jonas Hero avatar
    9 posts
    Member since:
    Jul 2009

    Posted 30 Jul 2010 Link to this post

    Thank you! I was using the Q1 2010 release which doesn't have this feature.
Back to Top