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控件,去掉 ...
随机推荐
- shell修改文件名(二)
我想修改类似如下一批文件的文件名:AA01_01.txtAA01_02.txtAA01_03.txtAA01_04.txt 修改成BB02_01.txtBB02_02.txtBB02_03.txtBB ...
- 去掉html标签和空格等
<?php$str = '<span style="color:#f00;">good; world</span>';echo $str.'<b ...
- IOS - UIImage
IOS中对图片的处理 UIImage UIImage 继承于NSObject 以下介绍一下UIImage中的方法 首先是我们最经常使用的 通过图片的文件名称来获取这个图片 + (UIImage *)i ...
- 【linux c learn 之stat】获取文件的属性
NAME stat 获取文件属性 这个函数位于<sys/stat.h>头文件里 函数原型: int stat(const char *path, struct stat *buf); 參数 ...
- Array.prototype.slice.call(arguments) 类数组转成真正的数组
Array.prototype.slice.call(arguments) 我们知道,Array.prototype.slice.call(arguments)能将具有length属性的对象转成数 ...
- C#_delegate - 调用列表 计算阶乘
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Dele ...
- nginx---reference
nginx (pronounced "engine x") is a free open source web server written by Igor Sysoev, a R ...
- 斐波那契数列_java版本
package 斐波那契数列; public class fbnq { public static void main(String[] args){ System.out.println(fibon ...
- 如何使用VSTS做压力测试
1 前言 1.1 目的 本文档主要介绍如何在VSTS环境中进行LoadTest测试,给测试人员和初次使用者提供参考. 对该工具进行LoadTest测试的优劣进行简单的分析说明. 1.2 软件版本 本文 ...
- my_vimrc
" ----------------- Author: Ruchee" ----------------- Email: my@ruchee.com" --------- ...