asp.net服务器向客户端弹出对话框,但不使页面边白板_.NET_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > .NET > asp.net服务器向客户端弹出对话框,但不使页面边白板

asp.net服务器向客户端弹出对话框,但不使页面边白板

 2013/10/28 22:57:54  汪小汪同学  博客园  我要评论(0)
  • 摘要:1:usingSystem;2:usingSystem.Collections.Generic;3:usingSystem.Linq;4:usingSystem.Web;5:usingSystem.Web.UI;6:usingSystem.Web.UI.WebControls;7:8:publicpartialclassClientScript:System.Web.UI.Page9:{10:protectedvoidPage_Load(objectsender,EventArgse)11:
  • 标签:.net ASP.NET net 对话 白板 客户 服务器 客户端 服务
class="lnum">   1:  using System;
   2:  using System.Collections.Generic;
   3:  using System.Linq;
   4:  using System.Web;
   5:  using System.Web.UI;
   6:  using System.Web.UI.WebControls;
   7:   
   8:  public partial class ClientScript : System.Web.UI.Page
   9:  {
  10:      protected void Page_Load(object sender, EventArgs e)
  11:      {
  12:          Response.Write("<script>alert('test1---直接Response输出')</script>");
  13:   
  14:          Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('test2')</script>");
  15:   
  16:          if (!ClientScript.IsClientScriptBlockRegistered(this.GetType(), "ClientScriptBlock"));  
  17:          {
  18:              ClientScript.RegisterClientScriptBlock(this.GetType(), "ClientScriptBlock", "<script>alert('test3---靠近<form>先弹出')</script>");
  19:          }
  20:   
  21:          if (!ClientScript.IsStartupScriptRegistered(this.GetType(), "StartupScript"))
  22:          {
  23:              ClientScript.RegisterStartupScript(this.GetType(), "StartupScript", "<script>alert('test4---靠近</form>后弹出')</script>");
  24:          }
  25:   
  26:      }
  27:  }

可以通过查看页面源码,看看有什么不同…

发表评论
用户名: 匿名