Get ID of AutoCompleteBox that caused postback

3 posts, 1 answers
  1. Danny
    Danny avatar
    35 posts
    Member since:
    May 2012

    Posted 20 Jun 2014 Link to this post

    I have two autocomplete boxes on the page, and per the demo I'm setting their datasources in the Page_Load event. 

    I only want to hit the database once, however.   How can I get the ID of the control that initiated the postback?

    I've used:

    String control_id = Page.Request.Params.Get("__EVENTTARGET");

    However, it returns an empty string- I imagine that's because it's a parital postback. 
  2. Answer
    Nencho
    Admin
    Nencho avatar
    1458 posts

    Posted 25 Jun 2014 Link to this post

    Hello Danny,

    You could get the control which initiated the callback with slightly different approach from the demonstrated one :

    String control_id = Page.Request.Params.Get("__CALLBACKID");

    However, since the control works upon callbacks it should have a constant access to the underlying datasource (database).

    Regards,
    Nencho
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Danny
    Danny avatar
    35 posts
    Member since:
    May 2012

    Posted 30 Jun 2014 in reply to Nencho Link to this post

    Thanks Nencho, works perfectly. 
Back to Top