MVC 弹出提示框
第一种弹框成功后要刷新界面
[HttpPost]
public ActionResult Add(Maticsoft.Model.Project.ProjectMoneyPlan model)
{
model.Money = new Maticsoft.Model.Struct.DRMB(model.Money).ToDouble().ToString();
Maticsoft.BLL.User.LoginUser login = new Maticsoft.BLL.User.LoginUser();
model.Creater = login.Email;
try
{
if (bll.Exist("Pro_MoneyPlan", "where ProCode='" + model.ProCode + "' ", "ProCode") && bll.Exist("Pro_MoneyPlan", "where Year=" + model.Year , "Year") && bll.Exist("Pro_MoneyPlan", "where Month=" + model.Month, "Month"))
{
///弹框
string script = String.Format("<script>alert('数据已经存在!');location.href='{0}'</script>", Url.Action("Add"));
return Content(script ,"Text/html");
}
else
{
bll.Add(model);
return View("List");
}
}
catch (Exception ex)
{
return new Maticsoft.BLL.Error().DoError(ex);
}
}
第二种弹框成功后不刷新界面:
[HttpPost]
public ActionResult Add(Maticsoft.Model.Project.ProjectMoneyPlan model)
{
model.Money = new Maticsoft.Model.Struct.DRMB(model.Money).ToDouble().ToString();
Maticsoft.BLL.User.LoginUser login = new Maticsoft.BLL.User.LoginUser();
model.Creater = login.Email;
try
{
if (bll.Exist("Pro_MoneyPlan", "where ProCode='" + model.ProCode + "' ", "ProCode") && bll.Exist("Pro_MoneyPlan", "where Year=" + model.Year , "Year") && bll.Exist("Pro_MoneyPlan", "where Month=" + model.Month, "Month"))
{
ViewData["ProName"] = SelecOpption.GetOpption("PRO_B", "", "Code,Name");//获取项目名称
ViewData["Year"] = GetYear();
ViewData["Month"] = GetMonth();
///弹框
ViewBag.isExist = false;
return View();
}
else
{
bll.Add(model);
return View("List");
}
}
catch (Exception ex)
{
return new Maticsoft.BLL.Error().DoError(ex);
}
}
前台:
@if (ViewBag.isExist == false)
{
<script type="text/javascript">
alert("您要添加的数据已经存在!")
</script>
}
MVC 弹出提示框的更多相关文章
- 在mvc中弹出提示框
在传统的WebForm中,我们要弹出一个alert提示框非常简单,只要在页面中输出alert即可,比如输出: Response.Write("<script >alrer('我是 ...
- android标题栏上面弹出提示框(二) PopupWindow实现,带动画效果
需求:上次用TextView写了一个从标题栏下面弹出的提示框.android标题栏下面弹出提示框(一) TextView实现,带动画效果, 总在找事情做的产品经理又提出了奇葩的需求.之前在通知栏显示 ...
- android标题栏下面弹出提示框(一) TextView实现,带动画效果
产品经理用的是ios手机,于是android就走上了模仿的道路.做这个东西也走了一些弯路,写一篇博客放在这里,以后自己也可用参考,也方便别人学习. 弯路: 1.刚开始本来用PopupWindow去实现 ...
- PHP弹出提示框并跳转到新页面即重定向到新页面
本文为大家介绍下使用PHP弹出提示框并跳转到新页面,也就是大家所认为的重定向,下面的示例大家可以参考下 这两天写一个demo,需要用到提示并跳转,主要页面要求不高,觉得没必要使用AJAX,JS等, ...
- [转] 在Asp.net前台和后台弹出提示框
一.在前台弹出提示框 1.点击"A"标记或者"控件按钮"弹出提示框 <asp:LinkButton ID="lbtnDel" runa ...
- SilverLight 页面后台方法XX.xaml.cs 创建JS,调用JS ,弹出提示框
1.Invoke和InvokeSelf [c-sharp] view plaincopy public partial class CreateJSDemo : UserControl { publi ...
- 基于Jquery 简单实用的弹出提示框
基于Jquery 简单实用的弹出提示框 引言: 原生的 alert 样子看起来很粗暴,网上也有一大堆相关的插件,但是基本上都是大而全,仅仅几句话可以实现的东西,可能要引入好几十k的文件,所以话了点时间 ...
- iOS bug 之 H5 页面没有弹出提示框
描述:在安卓上有提示框,但是在iOS上没有提示框. step 1: 失误,是我没有在正确的位置设置网址. step 2: 修改之后,测试页能弹出提示框,但是正式的页面没有提示框. step 3: 我输 ...
- C#自动关闭弹出提示框
自动关闭弹出提示框(用一个小窗体显示提示信息):例如在一个form窗体中弹出自动关闭的提示框1.首先创建一个弹出提示信息的窗体 AutoCloseMassageBox,在里面拖一个lable控件,去掉 ...
随机推荐
- 眼下最好的JSP分页技术
2005-08-24 来源:CSDN 作者:wanchao2001 前言 在使用数据库的过程中,不可避免的须要使用到分页的功能,但是JDBC的规范对此却没有非常好的解决.对于这个需求非 ...
- POJ_1365_Prime_Land
//懒得解释 #include <iostream> #include <cstring> #include <cmath> #include <cstdio ...
- 关于jQuery对象与DOM对象
今天遇到了关于jQuery对象与dom对象的区分问题.具体如下:对于元素<span id="aa" class="aa">hyz</span& ...
- Redirect
Redirect To use this Class, add the following to the top of the file. use Redirect; Redirect::to($pa ...
- 你真的会用 SDWebImage?
SDWebImage作为目前最受欢迎的图片下载第三方框架,使用率很高.但是你真的会用吗?本文接下来将通过例子分析如何合理使用SDWebImage. 使用场景:自定义的UITableViewCell上有 ...
- JS实现字符串去重,数组去重
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- VirtualBox中centos网络配置
VirtualBox图形界面下有四种网络接入方式,它们分别是: 1.NAT 网络地址转换模式(NAT,Network Address Translation) 2.Bridged Adapter 桥接 ...
- Android之HTTP网络通信--GET传递(二)
根据上一篇写的是实现了通过url接口将接口中的数据显示出来,这次根据上一篇的基础,进一步说明一下AsynTask的使用. AsynTask类有几个函数是大家必须知道的. doInBackGround( ...
- openvswitch安装和使用 --修订通用教程的一些错误
1.下载openvswitch源文件,注意版本要适合操作系统内核. 推荐openvswitch2.0及其以上版本. 2.开始安装openvswitch cd openvswitch sudo ./bo ...
- C# 打印多页tif
注意点: 1.计算image对象总页数 image.GetFrameCount(FrameDimension.Page); 2.初始化当前页,并获取指定页内容 image.SelectActiveFr ...