So, I have a web dialog that is within a container. The dialog is used to update a ListBox column within a container. I am a little confused, my other containers get embedded within the Web Page so I have a folder full of the “base” containers and then on the Web Page will be the instance of the container basecontainer something like basecontainer1. This way, I am able to update fields in all containers from the page and any methods I want. However, the Web Dialog must be embedded within the “base” container. Thus if I try to update any fields, the web dialog is actually not in scope so any containers I try to access don’t exist.
I currently have an on cell click method on a listbox to open the dialog for editing. I set some properties in the dialog to pass variables, but if I try to then set properties from the dialog to outside I am unable to access anything. I tried making a global module and setting properties there as well, but again I am unable to access the web page. I found some similar questions but the answer didn’t work for me. I guess it’s a scoping issue, but there also doesn’t seem to be another way to attach a web dialog and I have tried making things global or using modules so not sure what to do . Any ideas greatly appreciated. Thanks! r
Sorry, I wasn’t very clear. I am trying to use a web dialog as a modal window to bring up fields to edit a listbox. The list box is within a container that I attach to the main web page. To open the modal I want to use a cellclick on listbox in that container, but you can only define event handlers in the container definition/layout. So, I have to attach my modal dialog to the container to be able to open it. Then I attach that container to the web page. I can open and pass properties, but I am trying to use a dismissed handler to check for field changes and then change fields in the container. Anything I do to change the fields from that dismissed handler says the fields dont exist. I tried directly editing and setting properties on a global module then calling a method to do it, but still tells me doesn’t exist. I am able to use the same method (of calling a method) when I do it directly from the container, but not from the dialog. I included a screenshot to show the layout. Statistics is the container I attach the dialog modal1 to, then attach container to page where it is statistics1. The issue is trying to update statistics1
Surely there is something wrong with your code. I use webdialogs in one of my webapps, which is entirely built with webcontainers and very few pages. I call dialogs in a manner similar to what Michel showed (specific instances of a base dialog; the dialog is not included in the container at design time) from methods within the containers, I have handler methods to handle the dismissed event of the dialogs. It all works very well.
It is time to share some code, so people can really help you.
If you want to be able to access the WebDialog from elsewhere, add a property to the WebPage or the session such as
d as Webdialog
Then you do this to display the WebDialog :
d = New MyDialog
//or session.d = new MyDialog
d.Show
And to access a control placed on the WebDialog :
d.Label1.Text = "Peace on earth for all good men"
//or
myvariable = d.label.Text[/quote]
I also did as suggested, but have the same problem as my OP, because I am calling this from a button in the container, the specific container I want to edit doesn’t actually exist.
[quote=373531:@Louis Desjardins]Surely there is something wrong with your code. I use webdialogs in one of my webapps, which is entirely built with webcontainers and very few pages. I call dialogs in a manner similar to what Michel showed (specific instances of a base dialog; the dialog is not included in the container at design time) from methods within the containers, I have handler methods to handle the dismissed event of the dialogs. It all works very well.
It is time to share some code, so people can really help you.[/quote]
I don’t have a problem calling or setting values inside the dialog. How are you using them? Are you returning data from the dialog? His example was to get data to the dialog.
Yes, I return values from the dialog and update fields in the container. In the dismissed handler method, I do as David indicated. Except since the handler method is already on the container, I use Self. I would recommend my approach if you are going to reuse the webdialog in more than one page and/or container. For example, a date picker can be used in many different pages/containers of the application. I use only one base date picker throughout the application to update each field as required.