i m using ASP.Net 2.0.
i open a new window from server side code of a button.i do some work in new window. now i want when i close this window,i want to fire a event in the parent window (like there is ListBox,i want to automatically fire the ListBox SelectedIndexChange Event,when the newly opened window is closed).So it is posible.Pls Help...........

hi,

check this code

in child window:
  ClientScript.RegisterStartupScript(this.GetType(), "msg", "alert(' Details Added Successfully!');window.close();window.opener.__doPostBack('ChildWindowPostBack', '');", true);
in parent window:

in the page load event
 this.ClientScript.GetPostBackEventReference(this, string.Empty);

        if (this.IsPostBack)
        {
            string eventTarget = (this.Request["__EVENTTARGET"] == null) ? string.Empty : this.Request["__EVENTTARGET"];

            if (eventTarget == "ChildWindowPostBack")
            {
//do your coding to fire listbox
            }
}
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.