I need to have a custom web dialog pop up that allows the user to enter some text and then return that text to a method that then does some processing of that text.
In desktop apps, I have a modal window that I have created. In that window, I have a function called "RunDialog" that has the following code:
Public Function RunDialog(LabelText As String, Optional FieldText as String) as String DialogLabel.Text = LabelText If FieldText <> "" Then UserInput.Text = FieldText End If me.ShowModal return theReturnValue End Function
To show my "User Dialog" I call the following code (TitleString is just a dummy variable in this example - this string is basically telling the user what information you want them to enter)
Dim w as New UserDialog Dim s as string = w.RunDialog(TitleString)
Now in Web apps, I don't want to create a new page so I've created a WebDialog. I have set its type to modal. The RunDialog function is exactly the same as the desktop. Here is how I open this one:
Dim wc As New WebSessionContext(CurrentWebSession) Dim w As New WebUserDialog sval = w.RunDialog(TitleString)
I need to add the WebSessionContext as this call is actually coming from a server based object so I need to track the session.
This works but there's a problem. When the WebDialog is constructed, it shows that its type is 3 = Modal. However, when the open event fires (and also the shown event), the type is 1 = Sheet. So the WebDialog is not maintaining it's type between the time it is constructed and the time that it is shown. That seems to be a bug to me, but maybe I am doing something wrong but I don't see what. Everything works just as I want it, except the dialog is a sheet which is what I don't want.
I've added break points in the constructor method and can see that type is 3 before Super.Constructor executes and type is 3 after Super.Constructor executes. But I also put a break point between the code above after the WebDialog is created and before RunDialog is called. The type has already changed back 1. That just doesn't seem right.
UPDATE: OK, an update... If I delete the constructor method (I don't actually need to use it), then things work fine. I'm not sure why having the constructor method in place mucks up the WebDialog but it does. I will probably file a bug report on this...