• Asp.NET消息框的使用


    一般都使用以下几种方法.
    1)   Button.Attributes.Add("onclick","javascript:return confirm('确定?');");
    这种方法..现在使用最的多..
    在www.csdn.net里有一文章就很好.
    http://www.csdn.net/Develop/Read_Article.asp?Id=20892
    大家可以看一下..会有很多收获.
    2)另一个方法..我不知道其它人有没有这么用.不过我是这么用的..很偷懒的办法京是
    <div id=div1 onclick="javascript:return confirm('确定?');"><asp:button id="Button1" runat="server" Text="Button"></asp:button></div>
    这个一样能实现..而且不用增加服务器的动作...不过有没有其它后果..就不..知道了..
    在DataGrid中一样在Button列中使用属性编辑器在文本(t)中写入
    <div id=div1 onclick="javasciprt:return confrim(确定?')">删除</div>就能在DataGrid中实现删除确认的功能..当然如果每行删除不一样你就得用其它方法了.
    http://www.csdn.net/Develop/Read_Article.asp?Id=20892
    中一样有介绍.
    3)可能有时候大家会这样的用处..就是你点击导入数据的Button的按钮后..希望能弹出一个alert('数据导入完成!')这样的信息.
    这里就得用另外的方法了..可能很多人都知道就是使用.
    Page.RegisterClientScriptBlock ();或Page.RegisterStartupScript();
    这两一功能上相差不是很大...且配合.Page.IsClientScriptBlockRegistered()或Page.IsStartupScriptRegistered();来使用的
    string scriptStr="<script language=javasciprt> alert('数据导放已完成')</"
    sciprtStr+="sciprt>";
    Page.RegisterStartupScript("alert1",sciprtStr);
    就Ok了.
    据说Page.RegisterClientScriptBlock ();比Page.RegisterStartupScript();好..
    但我不知道原因,哪位能说一下最好啦.
  • 相关阅读:
    poj 1328 Radar Installation (贪心)
    hdu 2037 今年暑假不AC (贪心)
    poj 2965 The Pilots Brothers' refrigerator (dfs)
    poj 1753 Flip Game (dfs)
    hdu 2838 Cow Sorting (树状数组)
    hdu 1058 Humble Numbers (DP)
    hdu 1069 Monkey and Banana (DP)
    hdu 1087 Super Jumping! Jumping! Jumping! (DP)
    必须知道的.NET FrameWork
    使用记事本+CSC编译程序
  • 原文地址:https://www.cnblogs.com/chinatefl/p/165819.html
Copyright © 2020-2023  润新知