?
Solved

VB.Net Web App Yes/No code MsgBox Alternative

Posted on 2014-04-23
6
Medium Priority
?
824 Views
Last Modified: 2014-05-29
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.
0
Comment
Question by:EDW_Gideon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 40019673
Is this a WinForms or ASP.Net app?
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 40019723
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.
0
 

Author Comment

by:EDW_Gideon
ID: 40020557
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.
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
LVL 83

Expert Comment

by:CodeCruiser
ID: 40020625
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?
0
 

Author Comment

by:EDW_Gideon
ID: 40020780
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.
0
 
LVL 26

Accepted Solution

by:
Alan Warren earned 2000 total points
ID: 40021671
Hi EDW_Gideon
Multiviews are good for managing programmatic flow, you can set the activeView index based on user response to questions, here's a small stand-alone sample page which should get you started:
<%@ Page Language="VB" %>

<!DOCTYPE html>

<script runat="server">

  Protected Sub RadioButtonList1_SelectedIndexChanged(sender As Object, e As EventArgs)
    If RadioButtonList1.SelectedValue = 0 Then
      MultiView1.ActiveViewIndex = 1
    Else
      MultiView1.ActiveViewIndex = 2
    End If
  End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
      <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
        <asp:View ID="View1" runat="server">

          <h3>Question 1</h3>
          What is your gender?
          <asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="true" OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged">
            <asp:ListItem Text="Female" Value="1" />
            <asp:ListItem Text="Male" Value="0" />
          </asp:RadioButtonList>
        </asp:View> 
        <asp:View ID="View2" runat="server">

          <h3>Questions for men</h3>
          Do you like beer?
          <asp:RadioButtonList ID="RadioButtonList2" runat="server" AutoPostBack="true">
            <asp:ListItem Text="Yes" Value="1" />
            <asp:ListItem Text="No" Value="0" />
          </asp:RadioButtonList>

        </asp:View> 
        <asp:View ID="View3" runat="server">

        <h3>Questions for ladies</h3>
          Do you like shopping?
          <asp:RadioButtonList ID="RadioButtonList3" runat="server" AutoPostBack="true">
            <asp:ListItem Text="Yes" Value="1" />
            <asp:ListItem Text="No" Value="0" />
          </asp:RadioButtonList>
        </asp:View> 
      </asp:MultiView>    

    </div>
    </form>
</body>
</html>

Open in new window

Multiviews inside formview itemtemplates can be data driven

Respectfully yours,
Alan
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question