mvc controller中显示弹框提示 用mvc4做的,求代码思路
点击评价订单页面判断订单是否可以评价,如果可以评价需要打开一个新标签页面,如果不可以评价则在本页面给出弹框提示////html代码<buttonclass="btnyel...
点击评价订单页面判断订单是否可以评价,如果可以评价需要打开一个新标签页面,如果不可以评价则在本页面给出弹框提示
////html代码
<button class="btnyellow commentbtn" onclick="javascript:window.open('@Url.Action("CommentOrder", "Order", new { id = item.OrderID,pageName = "Order_MyOrder" })')">评价订单</button>
////c# controller中的代码
/// <summary>
/// 评价订单
/// </summary>
/// <returns></returns>
public ActionResult CommentOrder(int id,string pageName)
{
string userID = User.CurrentUser().UserID;//得到用户编号
ViewData["orderID"] = id;
int orderID = id;
int result;
var i_Order = OrderSystem.OrderDetailByOrderIDandUserID(orderID, userID, out result);
ViewBag.pageName = pageName;
switch (result)
{
case -3:
//return JavaScript("<script>window.alert('订单号后" + id.ToString().Length + "为:" + id + "的订单已评价或暂时无法评价!');location.href='/Order/MyOrder.html';</script>");
return JavaScript("alert('验证失败!)");
case -2:
return JavaScript("<script>window.alert('订单号后" + id.ToString().Length + "为:" + id + "的订单错误!');location.href='/Order/MyOrder.html';</script>");
default:
if (i_Order == null)
return RedirectToAction("MyOrder");
else
return View(i_Order);
}
}
//结果
如果不可以评价,希望弹框直接在订单详情的页面弹框提示,否则在新标签页面打开评价页面 展开
////html代码
<button class="btnyellow commentbtn" onclick="javascript:window.open('@Url.Action("CommentOrder", "Order", new { id = item.OrderID,pageName = "Order_MyOrder" })')">评价订单</button>
////c# controller中的代码
/// <summary>
/// 评价订单
/// </summary>
/// <returns></returns>
public ActionResult CommentOrder(int id,string pageName)
{
string userID = User.CurrentUser().UserID;//得到用户编号
ViewData["orderID"] = id;
int orderID = id;
int result;
var i_Order = OrderSystem.OrderDetailByOrderIDandUserID(orderID, userID, out result);
ViewBag.pageName = pageName;
switch (result)
{
case -3:
//return JavaScript("<script>window.alert('订单号后" + id.ToString().Length + "为:" + id + "的订单已评价或暂时无法评价!');location.href='/Order/MyOrder.html';</script>");
return JavaScript("alert('验证失败!)");
case -2:
return JavaScript("<script>window.alert('订单号后" + id.ToString().Length + "为:" + id + "的订单错误!');location.href='/Order/MyOrder.html';</script>");
default:
if (i_Order == null)
return RedirectToAction("MyOrder");
else
return View(i_Order);
}
}
//结果
如果不可以评价,希望弹框直接在订单详情的页面弹框提示,否则在新标签页面打开评价页面 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询