0
我在ASP.Net Web項目的js文件中有以下方法。這種方法是給錯誤 無法調用空的「分裂」JS錯誤:無法調用null的方法
function loadUser_InfoCallBack(res)
{
var ret=res.value;
var senderGUID = ret.split(';')[0];
var senderText = ret.split(';')[1];
if(senderGUID.Length>0)
{
$('hiddenSender.value')=senderGUID;
$('hiddenText.value')=senderText;
}
}
任何人都可以提出這個錯誤的原因..
其中用於getOwnerInfo方法的代碼如下
[AjaxPro.AjaxMethod(AjaxPro.HttpSessionStateRequirement.ReadWrite)]
public string getOwnerInfo()
{
string strReturn = ";";
if (Session["User_GUID"] != null)
{
string strUserGUID = Session["User_GUID"].ToString();
string strIndGUID = "";
string strIndName = "";
//Initialize Connection String
cns = DAL360.Common.getConnection(HttpContext.Current.Session["Server"].ToString(), HttpContext.Current.Session["Database"].ToString());
DAL360.std_UserRepositoryArtifacts.std_UserRepository userRep = new DAL360.std_UserRepositoryArtifacts.std_UserRepository(cns);
std_User user = userRep.Getstd_UserByusr_GUID(new Guid(strUserGUID));
DAL360.std_IndividualRepositoryArtifacts.std_IndividualRepository indRep = new DAL360.std_IndividualRepositoryArtifacts.std_IndividualRepository(cns);
std_Individual ind = indRep.Getstd_IndividualByind_GUID(new Guid(user.usr_ind_GUID.ToString()));
if (ind != null)
{
strIndGUID = ind.ind_GUID.ToString();
strIndName = ind.ind_Prefix + " " + ind.ind_FirstName + " " + ind.ind_MiddleName + " " + ind.ind_LastName;
DAL360.std_IndividualAddressRepositoryArtifacts.std_IndividualAddressRepository iadRep = new DAL360.std_IndividualAddressRepositoryArtifacts.std_IndividualAddressRepository(cns);
List<std_IndividualAddress> iadList = iadRep.GetAllFromstd_IndividualAddressByIndGUID(ind.ind_GUID);
if (iadList != null && iadList.Count > 0)
{
std_IndividualAddress iad = iadList[0];
strIndName += " (" + iad.iad_City + ", " + iad.iad_State + ")";
}
}
strReturn = strIndGUID + ";" + strIndName;
}//end if statement
return strReturn;
}
而這種方法是在frmHome.aspx頁面的頁面後面的代碼中。當我嘗試打開頁面時出現錯誤frmHome.aspx
如何調用此函數?參數'res'沒有正確傳遞(或不包含'value'屬性),並且在賦值*錯誤中您將獲得一個*無效的左手邊你在'if'裏面的兩個任務... – CMS 2010-04-26 07:27:33
對這個方法的調用是這樣做的... NewProject.Home.frmHome.getOwnerInfo(loadUser_InfoCallBack) – 2010-04-26 07:29:48
這個調用是在同一個js文件 – 2010-04-26 07:37:56