设为首页
优惠IDC
收藏本站
六狼博客
六狼论坛
开启辅助访问
切换到窄版
用户名
Email
自动登录
找回密码
密码
登录
立即注册
只需一步,快速开始
只需一步,快速开始
快捷导航
门户
首页
BBS
云计算
大数据
手机
移动开发android,ios,windows phone,windows mobile
编程
编程技术java,php,python,delphi,ruby,c,c++
前端
WEB前端htmlcss,javascript,jquery,html5
数据库
数据库开发Access,mysql,oracle,sql server,MongoDB
系统
操作系统windows,linux,unix,os,RedHat,tomcat
架构
项目管理
软件设计,架构设计,面向对象,设计模式,项目管理
企业
服务
运维实战
神马
搜索
搜索
热搜:
php
java
python
ruby
hadoop
sphinx
solr
ios
android
windows
centos
本版
帖子
用户
六狼论坛
»
首页
›
WEB前端
›
Html/Css
›
让ymPrompt和asp.net配合的方法
返回列表
查看:
97
|
回复:
0
让ymPrompt和asp.net配合的方法
[复制链接]
chenxueyong
chenxueyong
当前离线
积分
171
窥视卡
雷达卡
升级
80.67%
当前用户组为
秀才
当前积分为
171
, 升到下一级还需要 29 点。
51
主题
51
主题
51
主题
秀才
秀才, 积分 171, 距离下一级还需 29 积分
秀才, 积分 171, 距离下一级还需 29 积分
积分
171
发消息
楼主
|
发表于 2013-1-29 07:29:47
|
显示全部楼层
|
阅读模式
<div class="cnt">ymPrompt是一个很好用的替换网页确定和取消对话框的脚本.有了它我们可以弹出很漂亮的对话框.用在asp.net里要做点小技巧.原因是button的onclientclick没等用户确定就提交了.
处理的方法关键在于回发,button类型,handler的配置.直接在button1里写是不行的,那样就马上提交了.方法就是在提交前进行确认,然后由回调函数提交表单.因为dopost客户端脚本在有不是button和imagebutton等回发控件的情况下才会触发,所以加一个usesubmitbehavior属性,让客户端有dopost脚本.谁感兴趣就做个控件吧. 最后就是把按钮隐藏了.
<div class="cnblogs_code">
实例代码
<%
@ Page Language
=
"
C#
"
AutoEventWireup
=
"
true
"
Codebehind
=
"
WebForm1.aspx.cs
"
Inherits
=
"
WebApplication1.WebForm1
"
%>
<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
>
<
html
xmlns
="http://www.w3.org/1999/xhtml"
>
<
head
runat
="server"
>
<
title
>
Untitled Page
</
title
>
<
script
type
="text/javascript"
src
="ymPrompt.js"
></
script
>
<
link
rel
="stylesheet"
type
="text/css"
href
="ymPrompt.css"
/>
</
head
>
<
body
>
<
form
id
="form1"
runat
="server"
>
<
div
>
<
asp:Button
ID
="Button1"
runat
="server"
Text
="Button"
OnClick
="Button1_Click"
UseSubmitBehavior
="false"
style
="display:none;"
/>
<
input
id
="Button2"
type
="button"
value
="button"
onclick
="ymPrompt.confirmInfo({message:'信息确认框功能测试',handler:handler})"
/>
<
script
type
="text/javascript"
>
var
handler
=
function
()
{
__doPostBack(
'
Button1
'
,
''
);
}
</
script
>
<%
--
http:
//
www.ajaxbbs.net
/
test
/
ymPrompt4.
0
/
demo.html
--
%>
<
asp:Label
ID
="Label1"
runat
="server"
Text
="Label"
></
asp:Label
>
</
div
>
</
form
>
</
body
>
</
html
>
回复
使用道具
举报
提升卡
置顶卡
沉默卡
喧嚣卡
变色卡
千斤顶
显身卡
返回列表
高级模式
B
Color
Image
Link
Quote
Code
Smilies
您需要登录后才可以回帖
登录
|
立即注册
本版积分规则
发表回复
回帖后跳转到最后一页
浏览过的版块
C++
Copyright © 2008-2020
六狼论坛
(https://it.6wolf.com) 版权所有 All Rights Reserved.
Powered by
Discuz!
X3.4
京ICP备14020293号-2
本网站内容均收集于互联网,如有问题请联系
QQ:389897944
予以删除
快速回复
返回顶部
返回列表