1.11M Members

Alert Box with ASP.NET and VB.NET

 
0
 

Hi all

I have, hopefully, a rather small query. I have been creating a system with asp/vb and as I was designing I used msgbox's. Of course when I then uploaded it to the company intranet it didn't like MsgBox. I understand that there are various ways of doing it, such as server side within the asp, however I need it to fit in with the following code:

If (salesOrderStage > 30 And salesOrderStage < 40) Then

            salesOrderStage = salesOrderStage - 30

            Dim updateSQL = "UPDATE TblSalesOrder SET SalesOrderCurrDate = GETDATE(), SalesOrderCurrTime = '" & currentTime & "', SalesOrderActionName = '" & fName & "', SalesOrderStage = " & salesOrderStage & "  WHERE SalesOrderID = " & cmbSopSelect.Text & ";"
            Dim cmdUpdate As New SqlCommand
            cmdUpdate.CommandText = updateSQL
            cmdUpdate.Connection = con
            cmdUpdate.ExecuteNonQuery()

            MsgBox("Order placed in Limbo")
            reloadPage()
        Else
            MsgBox("This order cannot be put into Limbo")
        End If

I would appreciate any ideas or comments :)

Thanks in advance

 
0
 

Client Side Code

<head runat="server">
    <title>Call JavaScript From CodeBehind</title>
    <script type="text/javascript">
        function Jigsawalert() {
            alert('Jigsaw is coming for you !');
        }
    </script>
</head>

On Button Click (Server Side Code)

Page.ClientScript.RegisterStartupScript(this.GetType(),
            "alert", "Jigsawalert();", true);

I hope you are loking for this.
Try this and let us know your feedback !

 
0
 
If (salesOrderStage > 30 And salesOrderStage < 40) Then
     
    salesOrderStage = salesOrderStage - 30
     
    Dim updateSQL = "UPDATE TblSalesOrder SET SalesOrderCurrDate = GETDATE(), SalesOrderCurrTime = '" & currentTime & "', SalesOrderActionName = '" & fName & "', SalesOrderStage = " & salesOrderStage & " WHERE SalesOrderID = " & cmbSopSelect.Text & ";"
    Dim cmdUpdate As New SqlCommand
    cmdUpdate.CommandText = updateSQL
    cmdUpdate.Connection = con
    cmdUpdate.ExecuteNonQuery()
     
    //MsgBox("Order placed in Limbo")
[B]Response.Write("<script language='javascript'> alert('Order placed in Limbo'); </script>")[/B]
    reloadPage()
    Else
    //MsgBox("This order cannot be put into Limbo")
[B]Response.Write("<script language='javascript'> alert('This order cannot be put into Limbo'); </script>")[/B]
    End If

Rep and up appreciated.

 
0
 

Thank you for all the responses! I tried all those suggested but in the end the code I found to work was the following:

If (txtStage.Text < 990 Or (txtStage.Text > 30 And txtStage.Text < 40)) Then
            If (txtStage.Text < 10) Then
                salesOrderStage = salesOrderStage + 30
            ElseIf (txtStage.Text >= 10 And txtStage.Text < 20) Then
                salesOrderStage = salesOrderStage + 20
            End If

            Dim updateSQL = "UPDATE TblSalesOrder SET SalesOrderCurrDate = GETDATE(), SalesOrderCurrTime = '" & currentTime & "', SalesOrderActionName = '" & fName & "', SalesOrderStage = " & salesOrderStage & "  WHERE SalesOrderID = " & cmbSopSelect.Text & ";"
            Dim cmdUpdate As New SqlCommand
            cmdUpdate.CommandText = updateSQL
            cmdUpdate.Connection = con
            cmdUpdate.ExecuteNonQuery()

            ClientScript.RegisterStartupScript(Me.GetType(), "AlertMessageBox", "alert('Order placed in Limbo');", True)
            reloadPage()
        End If

Thanks again everyone!

Question Answered as of 3 Years Ago by dnanetwork, NETProgrammer and vishalrane
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article