读书人

return Content(quot;0quot;),该怎么处理

发布时间: 2013-04-09 16:45:09 作者: rapoo

return Content("0")

以前只看到Return view,return Content("0")百度下,就是返回一个文本,这个文本谁来接收呢? 返回后页面是个什么效果?


[HttpPost, ValidateInput(false)]
public ActionResult Show(int id, FormCollection values)
{
try
{
RegisteredUser va = GetCurrentUser();
if (va != null)
{
var cm = new Comment();
cm.VideoID = id;
cm.Content = values["Content"];
if (CommentBLL.AddComment(cm) == 1)
return PartialView("UCC",
GetPagedCommentsAndRepliesByVideoId(cm.VideoID, 1, CommentPageSize));
return Content("0");
}
return Content("-1");
}
catch (Exception ex)
{
return Content(ex.Message);
}

}

[解决办法]
本帖最后由 net_lover 于 2012-10-14 15:59:18 编辑 返回到response 中,也就是直接返回到浏览器上


一般使用ajax进行验证,直接返回0,-1进行判断,xmlhttp.resposneText
[解决办法]
谁调用的谁接

读书人网 >asp.net

热点推荐