I have a search form from where i am capturing a value in a global variable. Once the search form is closed, the focus returns to my main form as the search form is opened as a popup.

When the webform gets back the focus, i want to fire a subroutine based on this global variable. However I dont know which event should i tap to call this subroutine.

I have worked in vb where there was a form_activate event. Is there anything similar in ASP .net?

Please help

What I would do is run a timer on the first form that checks a Session object like

If Session("SearchClosed") = 2 then

Timer1.enabled = False
DO WHATEVER YOU WANT BECAUSE IT IS BACK TO THE FIRST FORM

End If

And before you close the search form set Session("SearchClosed") = 2
That way when the timer ticks on the first form, it knows the search window has closed. Fire the timer on the first form every few seconds... and enable the timer on the window pop-up. The "SearchClosed" will start with a value of 1.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.