popup window and postback
-
hi all, in my application i ve a datagrid in that a hyper link column "details" datagrid conatin student id , name , class when i click that hyperlink "details" a new window is opened with full details of that student(ie full name, address, location age dob...) and a button named as update in that new popup window i can change student datils and when press the update button it is updated in the database. up to this ok. my need is after updating databse the popup window is closed and control back to the parent page and its datagrid contain the updated details. now it is happend only after a post back or any other button click, my question is how i can automatically post back when the popup window closed and focus come back to the parent page? any soln for this situation? urgent:) All I ever wanted is what others have.... CrazySanker
-
hi all, in my application i ve a datagrid in that a hyper link column "details" datagrid conatin student id , name , class when i click that hyperlink "details" a new window is opened with full details of that student(ie full name, address, location age dob...) and a button named as update in that new popup window i can change student datils and when press the update button it is updated in the database. up to this ok. my need is after updating databse the popup window is closed and control back to the parent page and its datagrid contain the updated details. now it is happend only after a post back or any other button click, my question is how i can automatically post back when the popup window closed and focus come back to the parent page? any soln for this situation? urgent:) All I ever wanted is what others have.... CrazySanker
When you open a new window you have the ability to force execution of code on the parent. What you will need is the ability to force a post back event. Add a hidden button to your form. Click on the button and create the click event. The method that will be executed will reload the data for your datagrid. Now Add the following to your first page.
function reloadInformation() { __doPostBack('btn1','Click'); }
Like I said the click event will reload the data. Now on your popup page. We are going to need to execute some script once your update had run. To do that we will use the Page.RegisterClientScriptBlock event.private void btn1_Click(object sender, System.EventArgs e) { string scriptString = ""; // do work // ...... // // scriptString = "" + Environment.NewLine + "window.parent.execScript('reloadInformation()')" + Environment.NewLine + ""; Page.RegisterClientScriptBlock("clientscript",scriptString); }
References: registerclientscriptblock[^] Window Object[^] Hope this points you in the right direction.. Will I hate users. Not all of them, just the ones who talk.CP member: Al Einstien