[AjaxPro.AjaxMethod]
public void Mark(string strTerm,string bCode)
{
PartManageSyst.Model.AppraisalMark modelMark = new PartManageSyst.Model.AppraisalMark();
int total = 0;
int edit = 0;
if (!string.IsNullOrEmpty(strTerm))
{
if (strTerm.Contains(','))
{
string[] strList = strTerm.Split(',');
if (strList != null && strList.Length > 0)
{
int count=strList.Length;
for (int i = 0; i < count; i++)
{
if (!string.IsNullOrEmpty(strList[i]) && strList[i].Contains('|'))
{
total++;
string[] strArray = strList[i].Split('|');
if (strArray != null && strArray.Length > 0)
{
modelMark.bCode = bCode;
modelMark.cCode = strArray[2];
modelMark.OwnGrade = strArray[0];
modelMark.OrganizationGrade = strArray[1];
modelMark.OrgTime = DateTime.Now;
modelMark.OwnerTime = DateTime.Now;
modelMark.Year = DateTime.Now.Year.ToString();
PartManageSyst.BLL.AppraisalMark managerMark = new PartManageSyst.BLL.AppraisalMark();
int temp=managerMark.Add(modelMark);
if (temp > 0)
{
edit++;
}
}
}
}
}
}
}
if (edit.Equals(total) && !edit.Equals(0))
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('评分成功!')</script>");
}
else
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('并未全部评分成功,请重新添加!')</script>");
}
}
为什么弹提示框弹不出来呢?调试的话,它也走“Page.ClientScript…” 然后就报错了…麻烦高手给看看,讲讲…
在调用ajaxmethod后js再alert不就好了吗?
估计是Page.ClientScript.RegisterStartupScript在AjaxMethod内不能这么用