Showing posts with label windowclose. Show all posts
Showing posts with label windowclose. Show all posts

Monday, March 26, 2012

UpdatePanel -> window.close

Good morning @dotnet.itags.org. all

I am working on a ModalDialog window, there i have UpdatePanel over the whole modalDialog, Inside of it several atlas/ajax components.
Inside on top i have a Button to save the Datasheet/ Data fields. On other modals before i did it like so:

btnSave_Onlick -> save data to SQL and after it (last command) Response.Write ....window.close / PageStartupScript...window.close...
It worked fine in the past, but now the button is inside of the updatepanel and it throws out a Error with the response.write method,
and if i use StartupScript it just dont close the window. Is there any method to do this events inside of an updatePanel event?

Thanks for reponses
Marc

Specifially - Response.Write commands kill the whole microsoft.ajax enviroment - specifically with the new BETA. (I learned the hard way unknowningly)...

The alterantive is to just use a label or textarea (html) and assign values to after doing whatever you need to display after whatever processing. Little confused though are you talking window close as in IFRAME or modalpopup.show() hide()? Your post seems to indicate you are using an iframe and not a modal...

None the less if modal - then wrap the form or whatever you present in the modal in a panel and on successful submit make it not visible and assign a lable or generichtmlcontrol and display whatever message you want in it with a close button ...


hello.

if you're trying to insert javascript statements from a partial postback then use the new registerXXX static methods of the scriptmanager class.


Ok Thanks Luis i will remind it for further things :D
After all, for this i just brought my button outside of the panel...wasnt that big problem.

UpdatePanel + JavaScript - window.close()

Hello!

Situation: 2 pages. ASP.NET 2.0, Microsoft Ajax Extension Beta 2, IIS6.

On first page by Click on "Show" button (asp:Button) - worked next Client Java script code - "window.open( 'page2.aspx', '', '' );".

Page2 - contents UpdatePanel and button "Close" (asp:Button) with follow simple Java script code: "self.close();".

If I'm click on "Show" button 3 times and close second page on "Close" button I have persist situation when IE not load second page and don't load any pages in 1 page after second page is closed.

If I'm put "Close" button outside UpdatePanel - all work right.

Thank you,

for any comments.

Igor

I think you have following code:

page1.aspx:
<asp:Button runat="server" ID="btn" OnClientClick="window.open('page2.aspx','','');" Text="Open" />

page2.aspx:
<asp:Button runat="server" ID="btn" OnClientClick="self.close();" Text="Close" /

1. Is there any reason than you are using <asp:Button /> instead of simple <input type="button" /> ?

2. for some control sets asp.net places following onclick code "__doPostBack('btn','')" to <asp:Button />. and you result onclick = "self.close();__doPostBack('btn','')". you can check it viewing page source in browser. (you can use OnClientClick="window.close();return false;//")

3. I always use window.close() instead of self.close();

so try rewrite code like this:

page1.aspx:
<input type="button" onclick="window.open('page2.aspx','',''); return false;" value="Open" />

page2.aspx
<input type="button" onclick="window.close(); return false;" value="Close" />

I think this must work ;)


Thank you!

It's work.