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

Get ID of AutoCompleteBox that caused postback

2 Answers 79 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Danny
Top achievements
Rank 2
Danny asked on 20 Jun 2014, 12:59 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Nencho
Telerik team
answered on 25 Jun 2014, 11:26 AM
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.

 
0
Danny
Top achievements
Rank 2
answered on 30 Jun 2014, 01:09 PM
Thanks Nencho, works perfectly. 
Tags
AutoCompleteBox
Asked by
Danny
Top achievements
Rank 2
Answers by
Nencho
Telerik team
Danny
Top achievements
Rank 2
Share this question
or