Welcome Guest Search | Active Topics | Sign In | Register

Keep Dialog open during postback Options
johnnycantcode
Posted: Thursday, November 19, 2009 2:06:01 AM
Rank: Newbie
Groups: Member

Joined: 11/19/2009
Posts: 2
I have read this post http://www.essentialobjects.com/forum/postst360_Using-dialog-to-update-database-records-and-control-workflow.aspx and this is exactly what I am trying to do. However when I click the save button to do the validation the Dialog ALWAYS closes. How do I keep the dialog open?

I even added a linkbutton to the "Content and Footer" Template demo and when I click the linkutton it close the dialog.

eo_support
Posted: Thursday, November 19, 2009 7:12:27 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

The dialog always automatically closes after a post back. If you wish to re-open it, you would need to set the dialog's InitialState to Visible. It will be something like this:

Code: C#
Dialog1.InitialState = EO.Web.DialogState.Visible;


Thanks!
johnnycantcode
Posted: Thursday, November 19, 2009 10:18:07 AM
Rank: Newbie
Groups: Member

Joined: 11/19/2009
Posts: 2
How can I get the Dialog from "flashing" during a postback. I have the Dialong in a callback panel. Also, the message addressed in the link above states "If any validation fails, the dialog will still be there with the validator error message displayed;" notice the dialog will still be there? Why have an AcceptButton if ANY postback closes the dialog?
eo_support
Posted: Thursday, November 19, 2009 10:35:30 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

As to your questions:

johnnycantcode wrote:
How can I get the Dialog from "flashing" during a postback. I have the Dialong in a callback panel.

Try put the CallbackPanel inside the dialog. When you have the dialog inside the CallbackPanel, the dialog will still be destroyed and recreated during each callback, which will cause the flashing effect. CallbackPanel does not prevent object from being destroyed. It only limits the scope of objects that are destroyed (Without CallbackPanel the whole page is destroyed and reloaded, with CallbackPanel only objects inside the CallbackPanel are destroyed and reloaded).

johnnycantcode wrote:
Also, the message addressed in the link above states "If any validation fails, the dialog will still be there with the validator error message displayed;" notice the dialog will still be there? Why have an AcceptButton if ANY postback closes the dialog?


That's for a regular button. Not for an AcceptButton. A regular button is not associated to the dialog in any way. When clicked, it does all the standard tasks such as triggering validators and if validators pass, it posts back the page. When the page is posted back, everything in the page is destroyed. As a result, the dialog is also destroyed and closed.

If you associate a regular button to the dialog by setting the dialog's AcceptButton to the ID of the dialog, then the dialog would modify the button's behavior in the following ways:

1. Always trigger ClientSideOnAccept first;
2. Triggers a post back only if the dialog's AcceptButtonPostBack is true;

In your case the easiest way for you is probably to place a CallbackPanel inside the dialog. That way the dialog will always be there and whatever you do happens inside the dialog. If you do need to close the dialog on the client side (without post back), call the dialog's client side close method. It will be something like this:

Code: JavaScript
//You will need to change "Dialog1" to the ID of your dialog
eo_GetObject("Dialog1").close();


If you are not familiar with our client side JavaScript interface, you may want to go over this topic first:

http://doc.essentialobjects.com/library/1/clientapi_howto.aspx

Hope this helps.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.