Link to home
Start Free TrialLog in
Avatar of EDW_Gideon
EDW_GideonFlag for United States of America

asked on

VB.Net Web App Yes/No code MsgBox Alternative

I'm trying to find an alternative to MsgBox Yes/No to query users with different Yes No questions based upon where they are and what they're doing.  I've found some references to AJAX but I'm not sure how to call these from VB code midsteam after a user has initiated an action.  These decisions are being prompted by various scenarios provided after querying a database.  I'm looking for code suggestions, I've provided a sample of one scenario however the query to the user is different each time and there are numerous steps in just one of my routines.  Thanks for the assist!

      If SUSID = True Then
        MyMsg = "The ID (" & txtUserID.Text.ToString & ") is currently in a SUSPENDED status, do you want to unsuspend the ID?"
        If MsgBox(MyMsg, vbYesNo + MsgBoxStyle.Information) = MsgBoxResult.Yes Then
             Unsuspend_ID(Session.Contents("ConExpDt").ToString)
        End if
      End If

Open in new window


BTW SUSID is determined by a value in a database.
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

Is this a WinForms or ASP.Net app?
First thing you need to understand is that web apps work on request response bases. If you want to ask user a question and get a response before proceeding, you will need to split your work into multiple pieces: a piece that asks the question and a piece that does the work depending on the answer from user. Reason for this is that if you invoke something from server, it will not show on the client side until the response is returned.
Avatar of EDW_Gideon

ASKER

Carl,

ASP.Net App

CC,

I guess my question would be OK I split the work, how does a given link know if it needs to ask the question?  Currently on my page I have one button that is used to "execute" the request, is there no way to conditionally ask a question?  The AJAX solution I eluded to earlier seems to always as a question when you click on it.
So you don't always want to ask the question? Always asking the question is easy. You just add a confirm box in onclientclick event.

Can you explain the scenario?
I'm creating a database user administration tool, essentially this page is creating users.  Sometimes a user has lost access and is being created again but the ID is only in a suspend status.  In this situation I want the tool to confirm with the web app user wants to proceed with the reinstatement.  This is a confirmation step to insure that the app user is aware of the status.  Additionally if the user who is requesting access has multiple ID's I need to prompt the app user if they want to proceed with creating another ID.

Since I have one execution button that in most cases will not need to prompt I'm not sure how to get this done if the prompt is link related.  Additionally the context of the message will change depending on the scenario.
ASKER CERTIFIED SOLUTION
Avatar of Alan Warren
Alan Warren
Flag of Philippines image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial