ajax.DLL 如何在前台执行后台的方法?无刷新联动
ajax.dll已经部署好
前台
function showdept() {Listdepnum()//这样调用行吗?}DropDownList3.Attributes.Add("onClick", "showdept()")<Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.Read)> _ Private Sub Listdepnum() '顯示部門 If DropDownList2.SelectedIndex <> -1 Then Dim strSQL As String Dim dsResult As New DataSet Dim clsDBProcess As New dbprocess.OledbProcess strSQL = "select dept_num,dept_nam from DEPT where fac_num='" & DropDownList2.SelectedValue & "'" dsResult = clsDBProcess.GetDataSet(Session("Server"), Session("Database"), strSQL) DropDownList3.DataSource = dsResult DropDownList3.DataTextField = "dept_nam" DropDownList3.DataValueField = "dept_num" DropDownList3.DataBind() DropDownList3.Items.Insert(0, New ListItem("请选择", " ")) End If End Sub以下是其它类同的调用例子 function Validata() { ClassesMaint.Listde(document.all.txtClsnum.value,Validata_Result_CallBack); } function Validata_Result_CallBack(response) { if (response.value != null) { var ds = response.value; if(ds != null && typeof(ds) == "object" && ds.tables != null) { for(var i=0; i<ds.tables[0].Rows.length; i++) { document.all.txtCrsnum.value=ds.tables[0].Rows[0].emp_chn_nam; return; } } } return } <Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.Read)> _ 'Private Sub Listdep(ByVal DropDownList2) '顯示部門 '=======>public function Listdep(ByVal DropDownList2) '顯示部門 Dim strSQL As String Dim dsResult As New DataSet Dim clsDBProcess As New dbprocess.OledbProcess strSQL = "select dept_num,dept_nam from DEPT where fac_num='" & DropDownList2 & "'" dsResult = clsDBProcess.GetDataSet(Session("Server"), Session("Database"), strSQL) '========设置返回值Listdep=dsResult'不知道vb.net设置对象为返回值是否需要set,如果是asp需要用set End function