473,769 Members | 2,102 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Not able to close Modal Dialog box

Hi,
I am opening an Modal dialog box using the window.Showmoda ldialogbox(), and
in that window i am having an aspx form with say one ASP.NET Button control.

i am doing some operation on the click event of the button control on the
server and finally closing the window by using the following statement at the
end of the click event of the button:
Response.Write( "<script language='javas cript'>window.c lose();</script>");

But instead of closing the windw, its poping up same window once again.

This behavior is specifict to the window.Showmoda ldialogbox(), if i will
use simple window.open() then everything works fine.

i also tried to add the attribute to the button control but its giving the
same problem.
Button1.Attribu tes.Add("onclic k","window.clos e()");

Can anybody help me out in this case to close the window after performing
some operation in the click event of the button.

Thanks
Hitesh
Nov 19 '05 #1
4 5517
Hitesh,

Just add

<base target=_self>

in the <head> section of your dialog.

Eliyahu

"Hitesh" <Hi****@discuss ions.microsoft. com> wrote in message
news:0D******** *************** ***********@mic rosoft.com...
Hi,
I am opening an Modal dialog box using the window.Showmoda ldialogbox(), and in that window i am having an aspx form with say one ASP.NET Button control.
i am doing some operation on the click event of the button control on the
server and finally closing the window by using the following statement at the end of the click event of the button:
Response.Write( "<script language='javas cript'>window.c lose();</script>");

But instead of closing the windw, its poping up same window once again.

This behavior is specifict to the window.Showmoda ldialogbox(), if i will
use simple window.open() then everything works fine.

i also tried to add the attribute to the button control but its giving the
same problem.
Button1.Attribu tes.Add("onclic k","window.clos e()");

Can anybody help me out in this case to close the window after performing
some operation in the click event of the button.

Thanks
Hitesh

Nov 19 '05 #2
Thanks Eliyahu! its closing now. But now i am in another problem, since you
have given such a cleaner solution so i just want to consult you why this is
happening. See i am having the following statements at the end the click
event:

Response.Write( "<script
language='javas cript'>window.o pener.document. getElementById( '" + fieldName
+"_ImageControl ').src='" + @imagePath + "';</script>");

Response.Write( "<script
language='javas cript'>window.o pener.document. getElementById( '" + fieldName
+"_DimentionLab el').innerText= '" + dimentionLabelT ext + "';</script>");

Response.Write( "<script
language='javas cript'>window.o pener.document. getElementById( '" + fieldName
+"_ShowImageLin k').innerText=' Click Image to view actual size';</script>");

Response.Write( "<script language='javas cript'>window.c lose();</script>");

Now after adding the base tag its throwing the following javascript error:

window.opener.d ocument is null or not an object can you suggest me why its
happening and how can i correct this?

I will be really thankfull to you for your knowldge sharing with me to solve
my problem.

"Eliyahu Goldin" wrote:
Hitesh,

Just add

<base target=_self>

in the <head> section of your dialog.

Eliyahu

"Hitesh" <Hi****@discuss ions.microsoft. com> wrote in message
news:0D******** *************** ***********@mic rosoft.com...
Hi,
I am opening an Modal dialog box using the window.Showmoda ldialogbox(),

and
in that window i am having an aspx form with say one ASP.NET Button

control.

i am doing some operation on the click event of the button control on the
server and finally closing the window by using the following statement at

the
end of the click event of the button:
Response.Write( "<script language='javas cript'>window.c lose();</script>");

But instead of closing the windw, its poping up same window once again.

This behavior is specifict to the window.Showmoda ldialogbox(), if i will
use simple window.open() then everything works fine.

i also tried to add the attribute to the button control but its giving the
same problem.
Button1.Attribu tes.Add("onclic k","window.clos e()");

Can anybody help me out in this case to close the window after performing
some operation in the click event of the button.

Thanks
Hitesh


Nov 19 '05 #3
Are you trying to pass values back from the dialog to the parent window? You
can encapsulate whatever you want to pass back into one javascript object
and pass it back in window.returnVa lue. The parent will receive it is a
result of your showModalDialog call.

Eliyahu

"Hitesh" <Hi****@discuss ions.microsoft. com> wrote in message
news:DD******** *************** ***********@mic rosoft.com...
Thanks Eliyahu! its closing now. But now i am in another problem, since you have given such a cleaner solution so i just want to consult you why this is happening. See i am having the following statements at the end the click
event:

Response.Write( "<script
language='javas cript'>window.o pener.document. getElementById( '" + fieldName
+"_ImageControl ').src='" + @imagePath + "';</script>");

Response.Write( "<script
language='javas cript'>window.o pener.document. getElementById( '" + fieldName
+"_DimentionLab el').innerText= '" + dimentionLabelT ext + "';</script>");

Response.Write( "<script
language='javas cript'>window.o pener.document. getElementById( '" + fieldName
+"_ShowImageLin k').innerText=' Click Image to view actual size';</script>");
Response.Write( "<script language='javas cript'>window.c lose();</script>");

Now after adding the base tag its throwing the following javascript error:

window.opener.d ocument is null or not an object can you suggest me why its
happening and how can i correct this?

I will be really thankfull to you for your knowldge sharing with me to solve my problem.

"Eliyahu Goldin" wrote:
Hitesh,

Just add

<base target=_self>

in the <head> section of your dialog.

Eliyahu

"Hitesh" <Hi****@discuss ions.microsoft. com> wrote in message
news:0D******** *************** ***********@mic rosoft.com...
Hi,
I am opening an Modal dialog box using the window.Showmoda ldialogbox(),
and
in that window i am having an aspx form with say one ASP.NET Button

control.

i am doing some operation on the click event of the button control on
the server and finally closing the window by using the following statement at the
end of the click event of the button:
Response.Write( "<script

language='javas cript'>window.c lose();</script>");
But instead of closing the windw, its poping up same window once again.
This behavior is specifict to the window.Showmoda ldialogbox(), if i will use simple window.open() then everything works fine.

i also tried to add the attribute to the button control but its giving the same problem.
Button1.Attribu tes.Add("onclic k","window.clos e()");

Can anybody help me out in this case to close the window after performing some operation in the click event of the button.

Thanks
Hitesh


Nov 19 '05 #4
Hi Eliyahu,

You are absolutely correct after posting the question i was also trying the
same and it worked.

lot of thanks for your suggestions in solving my problem.
"Eliyahu Goldin" wrote:
Are you trying to pass values back from the dialog to the parent window? You
can encapsulate whatever you want to pass back into one javascript object
and pass it back in window.returnVa lue. The parent will receive it is a
result of your showModalDialog call.

Eliyahu

"Hitesh" <Hi****@discuss ions.microsoft. com> wrote in message
news:DD******** *************** ***********@mic rosoft.com...
Thanks Eliyahu! its closing now. But now i am in another problem, since

you
have given such a cleaner solution so i just want to consult you why this

is
happening. See i am having the following statements at the end the click
event:

Response.Write( "<script
language='javas cript'>window.o pener.document. getElementById( '" + fieldName
+"_ImageControl ').src='" + @imagePath + "';</script>");

Response.Write( "<script
language='javas cript'>window.o pener.document. getElementById( '" + fieldName
+"_DimentionLab el').innerText= '" + dimentionLabelT ext + "';</script>");

Response.Write( "<script
language='javas cript'>window.o pener.document. getElementById( '" + fieldName
+"_ShowImageLin k').innerText=' Click Image to view actual

size';</script>");

Response.Write( "<script language='javas cript'>window.c lose();</script>");

Now after adding the base tag its throwing the following javascript error:

window.opener.d ocument is null or not an object can you suggest me why its
happening and how can i correct this?

I will be really thankfull to you for your knowldge sharing with me to

solve
my problem.

"Eliyahu Goldin" wrote:
Hitesh,

Just add

<base target=_self>

in the <head> section of your dialog.

Eliyahu

"Hitesh" <Hi****@discuss ions.microsoft. com> wrote in message
news:0D******** *************** ***********@mic rosoft.com...
> Hi,
> I am opening an Modal dialog box using the window.Showmoda ldialogbox(), and
> in that window i am having an aspx form with say one ASP.NET Button
control.
>
> i am doing some operation on the click event of the button control on the > server and finally closing the window by using the following statement at the
> end of the click event of the button:
> Response.Write( "<script language='javas cript'>window.c lose();</script>"); >
> But instead of closing the windw, its poping up same window once again. >
> This behavior is specifict to the window.Showmoda ldialogbox(), if i will > use simple window.open() then everything works fine.
>
> i also tried to add the attribute to the button control but its giving the > same problem.
> Button1.Attribu tes.Add("onclic k","window.clos e()");
>
> Can anybody help me out in this case to close the window after performing > some operation in the click event of the button.
>
> Thanks
> Hitesh


Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2559
by: cassidyc | last post by:
Hi, I was wondering if anyone has come accross this issue? And if they have any solutions I have that can create new copies of itself Form1 as = new form1(); af.show(); This form can also bring up a modal dialog (MessageBox)
2
16148
by: Simon Storr | last post by:
Is it possible to make the parent window refresh when a modal dialog is closed? I know I can use window.opener.location.reload(true); for a 'normal' window, but this doesn't work for showModalDialog. It is modal as far as the client is concerned but not the server... In my app I have a datagrid on the main aspx page, I pop up a modal dialog to edit a record. On closing the modal dialog I'd like to refresh the
8
2226
by: william | last post by:
Hi All, I have a question about closing a dialog box. The thing is: I have two ASP.NET pages. From one page, I open another page as window.showModalDialog. THere is a button on the second page. On the click event of the button on second page, I put code "Response.Write("<script language='javascript'> { self.close();}</script>")" or "Response.Write("<script language='javascript'> { window.close();}</script>")". But it doesn't work. WHen I...
2
3309
by: anil kumar via .NET 247 | last post by:
(Type your message here) hi, i am using save & cancel webform button my webpage to with somevalidations , when i am trying to save my content it is savedthat time i need a popup msg like ur 'data is saved' , and wheni am trying to click on cancel the page should terminate witheffecting of validations . and how to open a modal dialog page through vbscript -------------------------------- From: anil kumar ----------------------- Posted by...
1
2803
by: Alex Brown | last post by:
I am writing a vb.net windows application and am using functionality in a com dll written in vb6. There is a modal dialog that pops up when I call a function in the dll that I want to automatically close. I am 90% sure that the dialog is generated by the vb6 msgbox funciton. I don't need to do anything except close the dialog - it just has an OK button. What is the easiest and best way to close the dialog automatically? Thanks!
2
3686
by: sthrudel | last post by:
Hi! I'm working on a web application in Asp.net and what I would like to have is a cross borwser modal dialog which accepts user's input. I would like to catch what the user clicked on the dialog. To be more specific I want to have a confirmation dialog that is shown when a user clicks on a Delete button (which deletes some values from database). If Yes is pressed the delete action is processed otherwise modal dialog is closed.
1
3870
by: dan.c.roth | last post by:
oForm.Close() vs this.Close() in a modal dialog. oFrom.Close() calls Form.Dispose() but this.Close() ,say in the click event of the Form, does not. I can think of the reason for this but is this documented and if so can someone give me the reference. And is this true for .net 1 and 2. Thanks
2
1462
by: Thiago Macedo | last post by:
Hello everybody. I'm experiencing an strange problem with WinForms which someone, if possible, could help me to deal with. We have a windows application which serves as a menu, calling other forms in different class library, all called as Modal Dialog. In one of this forms, I have another call to a Modal. When this second modal is closed, automatically is closed the form who called it. I can't understand how this is happening. After the...
0
9579
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10208
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10038
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9987
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9857
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7404
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3558
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.