zoukankan      html  css  js  c++  java
  • asp.net 后台弹出JS提示框或执行JS方法

    asp.net 后台弹出提示框 
    1.后台弹出提示信息方法
    Response.Write("<script type=\"text/javascript\">alert('你所查询的数据不存在!');</script>");
    //弹出提示信息,但页面空白
    Page.RegisterClientScriptBlock("tishi", "<script type=\"text/javascript\">alert('你所查询的数据不存在');</script>");
    //弹出提示信息,但页面空白
    Page.RegisterStartupScript("tishi", "<script type=\"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

    作者:Laggage

    出处:https://www.cnblogs.com/laggage/p/15095998.html

    说明:转载请注明来源

  • 相关阅读:
    Python安装及编辑器UliPad安装
    安装配置Django开发环境(Eclipse + Pydev)
    VsSDK_sfx.exe 安装出错
    [转]代码分析工具FxCop1.36之一:介绍与使用
    [转]IBM Rational系列产品介绍
    [转]C#控件——DataGridView单元格文本自动换行
    [转]FrameWork4.0的兼容问题 .
    【整理】C# ToString格式字符串整理(Format)(数字、日期和枚举的标准格式设置说明符)(SamWang)
    [转]史上最好的20本敏捷开发书籍
    [转]C#数字千分位问题
  • 原文地址:https://www.cnblogs.com/laggage/p/15095998.html
Copyright © 2011-2022 走看看