Winform与Webform中的对话框
2008-01-08 17:18
295 查看
参考MSDN
DialogResult result = MessageBox.Show("见过打劫的没?", "打、打、打劫", MessageBoxButtons.OKCancel, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
switch (result)
{
case DialogResult.OK:
MessageBox.Show("你按了确定");
break;
case DialogResult.Cancel:
MessageBox.Show("你按了取消");
break;
}
【lxcnn】:
抱歉,最近头晕,看成winform了,webform我再看下代码
【GaoFX】:
你如果想在CodeBehind代码过程中弹出对话框让用户作出选择,呵呵,俺认为是不可能的。
如果是在页面的客户端脚本中,太多了,可以window.confirm,也可以自己写一个页面showModalDialog显示出来。
【lxcnn】:
看你想实现什么样的效果吧
Response.Write("<script languge=javascript'>if(confirm('你确定结贴?')){alert('你按了确定')}else{alert('你按了取消')}</script>");
另一种是在Page_Load里加
Button1.Attributes.Add("onclick", "return confirm('你确定要结帖吗?')");
点确定执行Click事件,点取消则不执行
【yanming_01】:
假设你要实现的是删除一条语句
但你要做2次判断
用个textBox来说明
if(){Response.Write("<script>alert('你却定删除吗!');</script>");}
else
{Response.Write("<script>alert('取消删除!');</script>");}
DialogResult result = MessageBox.Show("见过打劫的没?", "打、打、打劫", MessageBoxButtons.OKCancel, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
switch (result)
{
case DialogResult.OK:
MessageBox.Show("你按了确定");
break;
case DialogResult.Cancel:
MessageBox.Show("你按了取消");
break;
}
【lxcnn】:
抱歉,最近头晕,看成winform了,webform我再看下代码
【GaoFX】:
你如果想在CodeBehind代码过程中弹出对话框让用户作出选择,呵呵,俺认为是不可能的。
如果是在页面的客户端脚本中,太多了,可以window.confirm,也可以自己写一个页面showModalDialog显示出来。
【lxcnn】:
看你想实现什么样的效果吧
Response.Write("<script languge=javascript'>if(confirm('你确定结贴?')){alert('你按了确定')}else{alert('你按了取消')}</script>");
另一种是在Page_Load里加
Button1.Attributes.Add("onclick", "return confirm('你确定要结帖吗?')");
点确定执行Click事件,点取消则不执行
【yanming_01】:
假设你要实现的是删除一条语句
但你要做2次判断
用个textBox来说明
if(){Response.Write("<script>alert('你却定删除吗!');</script>");}
else
{Response.Write("<script>alert('取消删除!');</script>");}
相关文章推荐
- webform 和 winform两者区别
- 一个WinForm记事本程序(包含主/下拉/弹出菜单/打开文件/保存文件/打印/页面设置/字体/颜色对话框/剪切版操作等等控件用法以及记事本菜单事件/按键事件的具体代码)
- C#中winform,webform多层架构理解
- C#(Winform)的SaveFileDialog(文件保存对话框)控件使用
- winform对话框拖拽显示文件路径的问题
- 当前目录c# winform和webform
- c#(winform,webform通用)利用npoi将xls文件复制为xlsx文件(excel的修改,保存,包括excel2003-office2007+的处理)
- 一个WinForm记事本程序(包含主/下拉/弹出菜单/打开文件/保存文件/打印/页面设置/字体/颜色对话框/剪切版操作等等控件用法以及记事本菜单事件/按键事件的具体代码)
- WebForm中按钮启动WinForm,求教IE7中的解决方案
- winform 对话框控件
- winform模式对话框和非模式对话框
- C#之WinForm基础 点击按钮出现 打开文件的对话框
- C#之WinForm基础 设置保存文件对话框的文件类型
- winform需要缓存吗?webform的缓存的作用?
- .NET各大平台数据列表控件绑定原理及比较(WebForm、Winform、WPF)
- WebForm和WinForm取当前根目录的通用的方法[转载]
- 浅谈通过winForm控制webForm的上传控件file的值
- winform(C#)里弹出“确定”“取消”对话框
- WinForm与WebForm调试输出
- winform对话框用法