我想在sendMes()中调用SendMessage()为什么不成功,那位高手帮忙解答一下。谢谢。
后台代码
/// <summary>
/// 注册页面js
/// </summary>
protected void RegeditPageFunction()
{
StringBuilder strScript = new StringBuilder();
strScript.AppendLine("function sendMes(a)");
strScript.AppendLine("{");
strScript.AppendLine("var isSend = confirm(\"是否发送祝福?\")");
strScript.AppendLine("if(isSend==true)");
strScript.AppendLine("{");
strScript.AppendLine("var fun = \"<%=SendMessage('\"+a.name+\"');%>\";");
strScript.AppendLine("alert(fun);");
strScript.AppendLine("}else{");
strScript.AppendLine("return false;");
strScript.AppendLine("}");
strScript.AppendLine("}");
Page.ClientScript.RegisterStartupScript(this.GetType(), "aaa", strScript.ToString(), true);
}
public string SendMessage(string getPerson)
{
//using (SPWeb web = SPContext.Current.Site.OpenWeb())
//{
// SPList list = web.GetList(LeaveUrl);
// SPListItem listItem = list.Items.Add();
// listItem["标题"] = LeaveMes;
// listItem["留言时间"] = DateTime.Now;
// listItem["发送人"] = SPContext.Current.Web.CurrentUser.LoginName;
// listItem["接收人"] = getPerson;
// listItem["内容"] = LeaveMes;
// listItem["悄悄话"] = "否";
// listItem["回复记录ID"] = "0";
// listItem.Update();
//}
return getPerson;
}
后台代码
/// <summary>
/// 注册页面js
/// </summary>
protected void RegeditPageFunction()
{
StringBuilder strScript = new StringBuilder();
strScript.AppendLine("function sendMes(a)");
strScript.AppendLine("{");
strScript.AppendLine("var isSend = confirm(\"是否发送祝福?\")");
strScript.AppendLine("if(isSend==true)");
strScript.AppendLine("{");
strScript.AppendLine("var fun = \"<%=SendMessage('\"+a.name+\"');%>\";");
strScript.AppendLine("alert(fun);");
strScript.AppendLine("}else{");
strScript.AppendLine("return false;");
strScript.AppendLine("}");
strScript.AppendLine("}");
Page.ClientScript.RegisterStartupScript(this.GetType(), "aaa", strScript.ToString(), true);
}
public string SendMessage(string getPerson)
{
//using (SPWeb web = SPContext.Current.Site.OpenWeb())
//{
// SPList list = web.GetList(LeaveUrl);
// SPListItem listItem = list.Items.Add();
// listItem["标题"] = LeaveMes;
// listItem["留言时间"] = DateTime.Now;
// listItem["发送人"] = SPContext.Current.Web.CurrentUser.LoginName;
// listItem["接收人"] = getPerson;
// listItem["内容"] = LeaveMes;
// listItem["悄悄话"] = "否";
// listItem["回复记录ID"] = "0";
// listItem.Update();
//}
return getPerson;
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货