注册AjAx:
Session(
"
pageName
"
)
=
Me
.GetType().Name
' 註冊Ajax方法
Ajax.Utility.RegisterTypeForAjax( Me .GetType(), Me )
' 註冊Ajax方法
Ajax.Utility.RegisterTypeForAjax( Me .GetType(), Me )
后台AJAX函数:
'
'' <summary>
' '' 返回:User工号
' '' </summary>
' '' <param name="UserId">PK_USERS</param>
' '' <returns></returns>
' '' <remarks></remarks>
< Ajax.AjaxMethod() > _
Public Function GetUserNo( ByVal UserId As Integer ) As DataSet
Dim ds As DataSet = New DataSet
Dim strsql As String = ""
strsql = " SELECT ufd04 as userno FROM [users] WHERE PK_USERS= " & UserId
ds = SqlHelper.ExecuteDataset(conn_flow, CommandType.Text, strsql)
Return ds
' '' 返回:User工号
' '' </summary>
' '' <param name="UserId">PK_USERS</param>
' '' <returns></returns>
' '' <remarks></remarks>
< Ajax.AjaxMethod() > _
Public Function GetUserNo( ByVal UserId As Integer ) As DataSet
Dim ds As DataSet = New DataSet
Dim strsql As String = ""
strsql = " SELECT ufd04 as userno FROM [users] WHERE PK_USERS= " & UserId
ds = SqlHelper.ExecuteDataset(conn_flow, CommandType.Text, strsql)
Return ds
function
getdate(tmp)
{
ajaxprotest.WebForm1.getdate(tmp,getdate_callback)
}
function getdate_callback(response)
{
var ds = GetUserNo("UserID号").value;
if (ds.Tables[ 0 ].Rows.length > 0 )
{
var cur = ds.Tables[ 0 ].Rows[ 0 ]; //前台取记录数
var name = ds.Tables[ 0 ].Rows[ 0 ].em_id;
document.all( " abc " ).value = name;
}
}
{
ajaxprotest.WebForm1.getdate(tmp,getdate_callback)
}
function getdate_callback(response)
{
var ds = GetUserNo("UserID号").value;
if (ds.Tables[ 0 ].Rows.length > 0 )
{
var cur = ds.Tables[ 0 ].Rows[ 0 ]; //前台取记录数
var name = ds.Tables[ 0 ].Rows[ 0 ].em_id;
document.all( " abc " ).value = name;
}
}
if
(.........)
{
document.all( " city " ).length = 0 ;
var ds = response.value;
if (ds != null && ds.Tables[ 0 ] != null )
{
document.all( " city " ).options.add( new Option( " 请选择城市 " , " 00 " ))
for ( var i = 0 ; i < ds.Tables[ 0 ].Rows.length; i ++ )
{
var name = ds.Tables[ 0 ].Rows[i].shiname;
var id = ds.Tables[ 0 ].Rows[i].shino;
document.all( " city " ).options.add( new Option(name,id));
}
}
}
{
document.all( " city " ).length = 0 ;
var ds = response.value;
if (ds != null && ds.Tables[ 0 ] != null )
{
document.all( " city " ).options.add( new Option( " 请选择城市 " , " 00 " ))
for ( var i = 0 ; i < ds.Tables[ 0 ].Rows.length; i ++ )
{
var name = ds.Tables[ 0 ].Rows[i].shiname;
var id = ds.Tables[ 0 ].Rows[i].shino;
document.all( " city " ).options.add( new Option(name,id));
}
}
}