call vb.net sub from javascript?

I have that code below.....it returns values from other page.......is there a way i can call a vb.net sub based on conditions.
that sub below has to be called if a condition in  function OnClientClose(oWnd, args) is met..

  Sub shipinvoice()
        Dim strConn2 As String = ConfigurationManager.ConnectionStrings("connectionUSSL").ConnectionString
        Dim conn2 As New SqlConnection(strConn2)
        Try
            conn2.Open()
            Dim cmd2 As New Data.SqlClient.SqlCommand("wmResharpShipInvoiceCoSp", conn2)
            cmd2.CommandType = CommandType.StoredProcedure
            cmd2.Parameters.Add("@co_num", SqlDbType.NVarChar).Value = Session("coNum")
            cmd2.Parameters.Add("@PWhse", SqlDbType.NVarChar).Value = Session("coNum")
            cmd2.Parameters.Add("@infobar", SqlDbType.NVarChar, 2800).Direction = ParameterDirection.Output
            Dim dr As Data.SqlClient.SqlDataReader = Nothing
            dr = cmd2.ExecuteReader()
        Catch ex As Exception
            c1.handleError("shipinvoice", ex.Message, "")
        Finally
            conn2.Close()
            conn2.Dispose()
        End Try
    End Sub
function OnClientClose(oWnd, args)
        {
            //get the transferred arguments
            var arg = args.get_argument();
            if (arg)
            {
                var cityName = arg.cityName;
                var seldate = arg.selDate;
                $get("order").innerHTML = "You chose to fly to <strong>" + cityName + "</strong> on <strong>" + seldate + "</strong>";
            }

Open in new window

WiggingAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ajb2222Commented:
The  way I do this is to have a hidden asp:button on the form that I can click from the java.

WiggingAuthor Commented:
could you elaborate a lil more?  
WiggingAuthor Commented:
or an example?
ajb2222Commented:
On the form place a hidden division, place buttons inside the division to hide them.

<div style="display:none"><asp:Button ID="Default_Action" Text="Authorize" Runat="server" OnClick="Default_Action_Click" /></div>

Open in new window



then to do the postback from java
setTimeout('__doPostBack(\'Default_Action\',\'\')', 0);

Open in new window


where Default action is the id of the button.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.