return PartialView 为什么别人可以显示嵌套在整页里边,我的只能返回PartialView ,图片在下边
如下: [HttpPost,ValidateInput(false)]
public ActionResult SimpleShow(string id, FormCollection values)
{ int typeId;
if (!int.TryParse(values["chatTypeId"], out typeId))
throw new IllegalOperationException("评论的文章、文库、视频已被删除"); //!!!没有检查id是否存在
Chat chat = new Chat();
chat.TypeId = typeId;
chat.LoginName = CurrentProject.GetCurrentUser().LoginName;
chat.Content = values["Content"];
chat.IP = Request.UserHostAddress;
chat.DateAdded = DateTime.Now;
switch (typeId)
{
case Constants.C_Article:
chat.ArtGuid = id;
break;
case Constants.C_Library:
chat.LibGuid = id;
break;
case Constants.C_Video:
chat.FilmGuid = id;
break;
}
int result = ChatBLL.ChatAdd(chat); //保存评论
if (result == 1) //保存成功,返回 分部视图
return PartialView("P_Chat", ChatBLL.GetChatsByGuid(id, Constants.C_Video, 1, Constants.PageCount_Chat));
return Content(result.ToString());
}
如下: [HttpPost,ValidateInput(false)]
public ActionResult SimpleShow(string id, FormCollection values)
{ int typeId;
if (!int.TryParse(values["chatTypeId"], out typeId))
throw new IllegalOperationException("评论的文章、文库、视频已被删除"); //!!!没有检查id是否存在
Chat chat = new Chat();
chat.TypeId = typeId;
chat.LoginName = CurrentProject.GetCurrentUser().LoginName;
chat.Content = values["Content"];
chat.IP = Request.UserHostAddress;
chat.DateAdded = DateTime.Now;
switch (typeId)
{
case Constants.C_Article:
chat.ArtGuid = id;
break;
case Constants.C_Library:
chat.LibGuid = id;
break;
case Constants.C_Video:
chat.FilmGuid = id;
break;
}
int result = ChatBLL.ChatAdd(chat); //保存评论
if (result == 1) //保存成功,返回 分部视图
return PartialView("P_Chat", ChatBLL.GetChatsByGuid(id, Constants.C_Video, 1, Constants.PageCount_Chat));
return Content(result.ToString());
}
ajax form 提交 就之前跳转了,不是局部刷新。