TextChanged event on the
TextBox control. It can actually be done quite easily.
In one of our ASP.NET Web Forms which is a part of our existing application, I was trying to implement and open an AJAX Modal Popup Extender dialog box on the click of an
OnPropertyChange event. The text box is actually a date picker control. If the user selects a date, then certain business logics get fired. But, just because of that, the modal popup control never worked with this form. Because, whenever the
ImageButton was clicked to open the modal dialog box, the
OnPropertyChange event was fired and the
form.submit method was called which did not let the modal dialog box to open. So, the situation was that I had to avoid the
form.submit method but keeping in mind that the business logic remained the same.
Using the code
To overcome this situation, I used the following code:
- I used the
GetPostbackEventReference method of the
Page object to register the ASP.NET server control which can create the postback using a client-side callback.
- Then, I used the
__dPostBack event to fire the
TextChanged event of the date picker control (
DoPostBack() for this.
- I called this function on the
OnChange event of the date picker control. And, I got the solution.
It's a very simple demonstration to show how to call a server-side ASP.NET event from the client-side. Please share your ideas if there is any other or better way to do this. I am available at firstname.lastname@example.org.