任何人都可以幫助我調用我的javascript函數內的VB.NET方法嗎?我的方法不共享/靜態,並不返回任何東西。它只是簡單地將數據保存到數據庫並重定向用戶。請幫幫我,這裏是我的代碼:在客戶端函數(Javascript)中調用Serverside方法
VB方法
Public Function SaveVehicles()
Dim res As Boolean
If res = True Then
Dim sModel As String = cboModel.SelectedValue
Dim sVariant As String = cboVariant.SelectedValue
Dim sColor As String = cboColor.SelectedValue
cboModel.SelectedValue = sModel
cboVariant.SelectedValue = sVariant
cboColor.SelectedValue = sColor
Dim oData As New WebServVehSwapping
Dim strSql As String
Dim sDealer As String
Dim sUserName As String
'sDealer = "TBP01"
sDealer = Trim(Request.QueryString("dealercode"))
If sDealer = "" Then sDealer = "TBP01"
sUserName = "User1"
'------------------------------------------
strSql = oData.InsertTblRequirement(_
sDealer _
, Now.ToString _
, sUserName _
, cboColor.Text.Trim _
, cboModel.Text.Trim _
, cboVariant.Text.Trim, "Open")
MsgBox("OKAY")
Response.Redirect("MyRequirements.aspx?DealerCode=" & sDealer)
Else
'do Nothing
End If
End Function
,這裏是我的JavaScript函數
function ConfirmView()
{
var Ok = confirm('There is/are existing vehicle(s) in Network Vehiches for sale, View Vehicle(s)?');
if(Ok==true)
{
location.href = 'NetworkVehiclesforSale.aspx';
return false;
}
else if (Ok!=true)
{
//THE VB METHOD GOES HERE
}
}
我已經試過了回調處理程序,它只是與功能的工作原理是返回的東西/字符串
我試過Pagemethod,但它只是與靜態/共享功能。請幫助我,我真的很需要它。 pleaase即時通訊pleasee。由於
如果我的回答對你有幫助,如果你考慮將其標記爲答案或詢問後續問題,我將不勝感激。 – Steve 2011-06-06 07:13:47