Welcome Guest Search | Active Topics | Sign In | Register

Suggestion please -- best way to open two consective dialogs Options
Peter249
Posted: Wednesday, May 15, 2013 12:49:18 PM
Rank: Advanced Member
Groups: Member

Joined: 5/15/2013
Posts: 34
Hi,

I am looking for any suggestions for coding with the EO.Web controls to get my desired results at my client end web page.

I have a single web page (application) which the client uses to perform all sorts of activities without post backs of the entire page. I have a custom Google Map control (one I wrote) and a eoMenu at the top of the screen. I have 1 eoDialog control to act as my Dialog interface to the many (about 20) different Dialogs.

Problem:
1) The user selects the Menu->EditThing
2) The OnClickScript() gets routed to my Google Map Control (in JavaScript resource) so the control can figure out what to do.

Note: It can do several things depending on other states of the Google Map Control.
- Show a FindThing dialog to get the ThingID which the application needs
- Show a EditThing dialog to actually edit the Thing with key ThingID

The Google Map Control logic will show the FindThing dialog if dose not know the ThingID, but if it does - it just shows the EditThing dialog. Note also the FindThing dialog can be called to just get a ThingID for the user with no edits (elsewhere in code).

When I show the FindThing dialog followed by the Edit Thing Dialog only the EditThing dialog shows !!

I was thinking of having the FindThing content of dialog redirect to the new dialog content on the dialog postback for the EditThing. I could pass a parameter on the dialog initialization to control the different modes of operation. But the eoDialog would have to resize depending on the content inside the dialog for each redirect. I don't think this is possible (could be wrong). I would also have to fiddle the AcceptID's to keep the dialog window open between callbacks -- a little hacky for me but I think possible.


Code sample (from my Google Map control's JavaScript):

Code: C#
proto.DoDialogShow = function (url, title, width, height)
    {
        gDialogResult = null;
        var dlg = eo_GetObject('Dialog1')
        dlg.resize (width, height);
        dlg.setContentUrl(url);
        dlg.show(true, title);
        return (dlg.getResult());
    }

    proto.MenuEditThing = function ()     // routed here from MenuItem.OnClickScript()
    {
        if (this._ThingID  == 0)
        {    this.DoDialogShow ("/ThingFindDlg.aspx", "Lookup Thing", 382, 148));
              // return if user cancels here
        }
        this.DoDialogShow ("/ThingEditDlg.aspx?id=" + this._ThingID, "Edit Thing", 625, 400));
    }


Any suggestions ???


eo_support
Posted: Wednesday, May 15, 2013 4:15:16 PM
Rank: Administration
Groups: Administration

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

We don't really help you on implementing your specific logic. :) So here we can only point you to a few things that the Dialog provides, so that you can evaluate each option and decide which feature/combination you will use.

The most important thing you will need to be aware of is, while the dialog can be modal, dlog.show() is NEVER blocking. All it does is to display the dialog and returns immediately. So it is wrong for the code to try to get any result from the dialog immediately calling dlg.show().

Your code that calls setSize/setContentUrl is fine. In fact that would be the recommended method when you have many dialogs in the same page ---- because it is not necessary to have duplicate instances of dialog controls in the page if at any given them there is only one visible.

I do not know why "When I show the FindThing dialog followed by the Edit Thing Dialog only the EditThing dialog shows". Both dialogs should show, but one should be stacked on top of another, so unless you close one dialog, the other one is not accessible. See here for an example:

http://demo.essentialobjects.com/Demos/Dialog/Features/Stacking%20Modal%20Dialogs/Demo.aspx

You can resize the dialog either any time, including when the page is being redirected/reloaded. However if you plan to resize the dialog upon page load, you must wait until the dialog is initialized. In order to achieve that, you can handle the dialog's ClientSideOnLoad event and then call your resizing code inside that event handler.

Hope this helps. Please feel free to let us know if you have any more questions.

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.