properly call a method from a container control into web dialog(modal)?

How to properly call a method from a container control into web dialog(modal)?

I have container control named “OfficialVehiclesContainer” with a “deletedata” method in it.
I have web dialog (modal) named “confirmdeleteitemdialog”. I need to call the method “deletedata” from the “OfficialVehiclesContainer”.
i already tried this : Var a As OfficialVehiclesContainer
a.DeleteData

was able to call the method but it wont work.

It is just for simple confirmation modal of deleting an item in a listbox.

Well… I would just not do that.

Others may disagree, but to me a dialog is something that is short lived and that loads its data every time it is called. So, you would create a base webdialog and you would create instances of the webdialog every time you need it. The instance would load its data fresh every time. Once you are done, you close that instance.

The scheme that I suggest would eliminate the need to update the dialog from pages or containers. So the better answer is probably that you need to rethink your architecture a bit. You can use handler methods to capture the results of the dialog in the calling object (page, container, etc.).

you can use the Dismissed Event

Dim d As New Modal1 d.Answer = "" AddHandler d.Dismissed, AddressOf DismissedHandler d.Show

in the Dialog you use a property and .Hide the dialog at button click

[code]Sub Action() Handles Action
Answer = “No”
Self.Hide

End Sub
[/code]

and in the DismissedHandler you read the property and close the Dialog

[code]Public Sub DismissedHandler(d As Modal1)

System.DebugLog(“DismissedHandler”)
System.DebugLog(d.Answer)
d.Close

… remove the handler here

End Sub
[/code]

OR alternate use dependencies injection and store your ContainerControl object in a dialog property,
u can use its public methods there in a button Action event.
the disadvantage you can’t reuse this dialog.