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

Recommended Answers

All 6 Replies

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 !

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.

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!

esa su mierda no sirve

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.