problem in closing the window
-
following is the code i am writing to open a dialog box
string str1 = "window.showModalDialog('child.aspx',null,'status:no;dialogWidth:300px;dialogHeight:150px;dialogHide:true;help:no;scroll:no');"; ScriptManager.RegisterStartupScript(Page, typeof(Page), "", str1, true);
there is a button called close in the child.aspx page. in clicking the button , i want to close the window.if (!Page.IsPostBack) { // this.Title = "hnihui"; //"window.opener.location=window.opener.location; string str = "window.close();"; Button1.Attributes.Add("onclick", str); }
but the code does not close the window. Please help.If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
-
following is the code i am writing to open a dialog box
string str1 = "window.showModalDialog('child.aspx',null,'status:no;dialogWidth:300px;dialogHeight:150px;dialogHide:true;help:no;scroll:no');"; ScriptManager.RegisterStartupScript(Page, typeof(Page), "", str1, true);
there is a button called close in the child.aspx page. in clicking the button , i want to close the window.if (!Page.IsPostBack) { // this.Title = "hnihui"; //"window.opener.location=window.opener.location; string str = "window.close();"; Button1.Attributes.Add("onclick", str); }
but the code does not close the window. Please help.If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
if (!Page.IsPostBack) { // this.Title = "hnihui"; //"window.opener.location=window.opener.location; string str = "window.close();"; Page.RegisterClientScriptBlock("CloseWindow",str); Button1.Attributes.Add("onclick", str); }
I Love T-SQL "Don't torture yourself,let the life to do it for you."
-
following is the code i am writing to open a dialog box
string str1 = "window.showModalDialog('child.aspx',null,'status:no;dialogWidth:300px;dialogHeight:150px;dialogHide:true;help:no;scroll:no');"; ScriptManager.RegisterStartupScript(Page, typeof(Page), "", str1, true);
there is a button called close in the child.aspx page. in clicking the button , i want to close the window.if (!Page.IsPostBack) { // this.Title = "hnihui"; //"window.opener.location=window.opener.location; string str = "window.close();"; Button1.Attributes.Add("onclick", str); }
but the code does not close the window. Please help.If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
-
i am opening an aspx page in the form of dialog box . While i am using ur code , it is not even closing the window , but also opening the same page i pop up window
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
-
i am opening an aspx page in the form of dialog box . While i am using ur code , it is not even closing the window , but also opening the same page i pop up window
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
-
following is the code i am writing to open a dialog box
string str1 = "window.showModalDialog('child.aspx',null,'status:no;dialogWidth:300px;dialogHeight:150px;dialogHide:true;help:no;scroll:no');"; ScriptManager.RegisterStartupScript(Page, typeof(Page), "", str1, true);
there is a button called close in the child.aspx page. in clicking the button , i want to close the window.if (!Page.IsPostBack) { // this.Title = "hnihui"; //"window.opener.location=window.opener.location; string str = "window.close();"; Button1.Attributes.Add("onclick", str); }
but the code does not close the window. Please help.If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
Hi, You can call Window.Close() in OnClientClick , This will close current window.( If it is popup this will close popup window)
-
following is the code i am writing to open a dialog box
string str1 = "window.showModalDialog('child.aspx',null,'status:no;dialogWidth:300px;dialogHeight:150px;dialogHide:true;help:no;scroll:no');"; ScriptManager.RegisterStartupScript(Page, typeof(Page), "", str1, true);
there is a button called close in the child.aspx page. in clicking the button , i want to close the window.if (!Page.IsPostBack) { // this.Title = "hnihui"; //"window.opener.location=window.opener.location; string str = "window.close();"; Button1.Attributes.Add("onclick", str); }
but the code does not close the window. Please help.If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
I don't know if that's your problem, but I remember that I was struggling few years ago with something similar. The headache was caused by the fact that postback in modal window doesn't really work as expected. The workaround was to do all the popup window eventhandling on clientside with javascript, or, better solution, have a iframe in your popup window and load your aspx page into that iframe. It is possible that your problem is something different, I just wanted to mention that this can be the case :)