How to offer a "confirm" dialog which then runs server side code

I was tasked with recoding an old VB6 page. This page will export data from our database and import it into another. While export / import is in progress I need to offer user confirmation fields. The context and results of these assertion flags depend on server side validation. In the old code, the author simply did:

If MsgBox (Msg, vbOKCancel) = vbOK Then
                    GoTo Function1
                Else
                    GoTo Function2
                End If

Yes, this is GoTos, don't remind me. This code is crude. Anyway, how can I do this in .NET with C # code?

0


a source to share


1 answer


Well, the code would be the same if it were in C #, although it would look something like this:

if (Interaction.MsgBox(Msg, Constants.vbOKCancel) == Constants.vbOK) {
    goto Function1;
}
else {
    goto Function2;
}

      



But if it's an ASP.NET application, it looks different. You will probably create a modal dialog and attach some click handlers to the buttons in that dialog.

[edit] By the way, if you ever have doubts about how VB code will look in C #, try a converter utility like this . They don't work all the time, but they do sometimes. Greetings.

+1


a source







All Articles