博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
.net后台弹出提示消息代码
阅读量:4582 次
发布时间:2019-06-09

本文共 2465 字,大约阅读时间需要 8 分钟。

 

提示对话框 页面不空白 跳转: Page.ClientScript.RegisterStartupScript(Page.GetType(), "message",  "<script language='javascript'>alert('恭喜您,操作成功!');window.location='SearchClientInfo.aspx'</script>");

Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('您不需要销假!');</script>")

Response.Write("<script type='text/javascript'>alert('修改成功!');</script>");

this.LinkButton3.Attributes.Add("onclick", "return confirm('确定要删除吗?');");

Page.RegisterStartupScript("aa", "<script>if(confirm('您没有登录,所以不能使用页面中功能,如需登录请点击确定!'))location.href='../Login.aspx' </script>");

1.后台弹出提示信息方法

Response.Write("<scripttype="text/javascript">alert('你所查询的数据不存在!');</script>");

//弹出提示信息,但页面空白 Page.RegisterClientScriptBlock("tishi", "<scripttype="text/javascript">alert('你所查询的数据不存在');</script>");

//弹出提示信息,但页面空白 Page.RegisterStartupScript("tishi", "<scripttype="text/javascript">alert('你所查询的数据不存在');</script>");//已过期,

//弹出提示信息,页面不空白 ClientScript.RegisterClientScriptBlock(this.GetType(), "tishi","<script type="text/javascript">alert('你所查询的数据不存在!');</script>");

//弹出提示信息,但页面空白 ClientScript.RegisterStartupScript(this.GetType(), "tishi","<script type="text/javascript">alert('你所查询的数据不存在!');</script>");

//弹出提示信息,页面不空白

//在vs2005中 需要引入System.Web.Extensions.dll ScriptManager.RegisterClientScriptBlock(this.btnTiShi, typeof(Button),"tishi", "alert('你所查询的数据不存在!');", true);

//弹出提示信息,但页面空白 ScriptManager.RegisterClientScriptBlock(this, this.GetType(),"tishi", "alert('你所查询的数据不存在!');", true);

//弹出提示信息,但页面空白,this表示page ScriptManager.RegisterStartupScript(this.btnTiShi, typeof(Button),"tishi", "alert('你所查询的数据不存在!');", true);

//弹出提示信息,页面不空白 ScriptManager.RegisterStartupScript(Page,typeof(Page), "tishi","alert('你所查询的数据不存在!');", true);

//弹出提示信息,页面不空白 ScriptManager.RegisterStartupScript(this, typeof(_Default), "tishi",script, true);

//弹出提示信息,页面不空白,this表示page

//后台获得confirm返回值,并有选择的执行语句块 C#端: protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.btnTiShi.Attributes.Add("onclick","tishi()"); } }

protected voidbtnTiShi_Click(object sender, EventArgs e) { if (this.hidevalue.Value == "1") { Response.Write("success"); } else { Response.Write("failue"); } }

JS端: <script type="text/javascript"> function tishi() { if(confirm('你确定要删除吗?')) { document.getElementByIdx_x('hidevalue').value='1'; //window.location.href=window.location.href; } else { document.getElementByIdx_x('hidevalue').value='0'; } } </script>

转载于:https://www.cnblogs.com/dongzhen/archive/2013/03/15/2961564.html

你可能感兴趣的文章
精通CSS:高级Web标准解决方案(第2版)(Amazon第一CSS畅销书全新改版)
查看>>
初识电流环
查看>>
MySQL每天自动增加分区
查看>>
在线生成坐标值,方便布局使用
查看>>
ab测试工具的使用
查看>>
RTL基本知识:编译命令指定隐性线网类型
查看>>
java中BigDecimal在金融行业中的使用
查看>>
66.Plus One
查看>>
爬虫——小结
查看>>
sticky bit
查看>>
sqlserver 中 where 条件和 join 条件的作用比较
查看>>
jvm解析和调优
查看>>
Linux 连接mysql服务器
查看>>
linux内核学习:中断中推后执行的部分
查看>>
数据库系统概论【基础篇】
查看>>
shell脚本中大于,大于等于,小于,小于等于、不等于的表示方法
查看>>
xcode 快捷键
查看>>
三十五.MySQL读写分离 MySQL多实例 、MySQL性能调优
查看>>
[LeetCode] 256. Paint House_Easy tag: Dynamic Programming
查看>>
Java基础——面向对象编程一:封装
查看>>