zoukankan
html css js c++ java
Javascript Return False 的重要性.
<
asp:DataGrid
>
<
Columns
>
<
asp:TemplateColumn HeaderText
=
"
发单
"
>
<
itemtemplate
>
<
asp:Button ID
=
"
btnFd
"
Runat
=
"
server
"
CssClass
=
"
Button60
"
Text
=
"
发单
"
CommandName
=
"
btnFd
"
></
asp:Button
>
</
itemtemplate
>
<
headerstyle wrap
=
"
False
"
width
=
"
60px
"
/>
<
itemstyle wrap
=
"
False
"
width
=
"
60px
"
/>
</
asp:TemplateColumn
>
<
Columns
>
</
Datagrid
>
以上是javascript 提示
private
void
dvList_ItemDataBound(
object
sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
//
发单按钮
if
(e.Item.ItemType
==
ListItemType.AlternatingItem
||
e.Item.ItemType
==
ListItemType.Item)
{
Button btnFd
=
(Button)e.Item.FindControl(
"
btnFd
"
);
string
id
=
((DataRowView)e.Item.DataItem).Row[
"
ID
"
].ToString();
btnFd.Attributes[
"
onclick
"
]
=
"
return btnFd_onclick('
"
+
id
+
"
');
"
;
}
}
以上是后台代码
//
发单按钮事件
function btnFd_onclick(id)
{
var url
=
"
PersonSelectFrame.aspx
"
;
var retval
=
window.showModalDialog(url,window,
'
DialogWidth:650px;DialogHeight:650px;Status:no;
'
);
if
(retval
!=
undefined
&&
retval
!=
null
)
{
document.getElementById(
"
hnJsry
"
).value
=
retval[
"
id
"
];
document.getElementById(
"
txJsry
"
).value
=
retval[
"
name
"
];
document.getElementById(
"
hnDeleteId
"
).value
=
id;
document.getElementById(
"
hnBtn
"
).click();
}
}
这样的话在执行hnBtn的click事件后继续会返回服务器端,导致此hnBtn的click事件中的脚本不执行.
需要在btnFd_onclick(id)后添加一个
return false;//it is very impossible;
添加后这个才ok.
查看全文
相关阅读:
程序员常见的口头禅,哈哈哈哈~
2020年以后,IT行业还能否继续那么“吃香”?
IntelliJ IDEA 15款 神级超级牛逼插件推荐(真的超级牛X)
实验6——力导向图
新的云端储存解决方案
Router Mesh
conda虚拟环境下,如果pip无法安装的包,可以试试下面这个命令
Version value must be a string; got a NilClass () (TypeError)
--use-feature=2020-resolver 检查环境冲突
焦虑情绪
原文地址:https://www.cnblogs.com/mishy/p/1071963.html
最新文章
flutter 集成fluwx ios配置 亲测
fatal: unable to access 'https://chromium.googlesource.com/webm/libwebp/': Failed to connect to chromium.googlesource.com port 443: Operation timed out
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
flutter TabBar改变tab大小
flutter 按钮点击后的样式
flutter 多个Text会导致出线的解决方法
iOS----------remote: HTTP Basic: Access denied
nmap 常用
渗透测试一般思路和手法
MS11_003漏洞复现(windows7IE溢出漏洞)
热门文章
【神奇GitHub】使用篇
【Linux】1-虚拟机管理软件安装/虚拟机网络模式介绍/远程连接 Xshell
【2020Python修炼记】Django Rest Framework-3-drf请求与响应
【2020Python修炼记】Django Rest Framework-2-drf序列化组件
【2020Python修炼记】Django Rest Framework-1-DRF简介+RESTful入门规范
【个人博客网站】如何搭建个人博客网站
【教程干货】技术学习资料汇总
我的编程能力从什么时候开始突飞猛进
函数式编程概述
Elastic Search搜索引擎在SpringBoot中的实践
Copyright © 2011-2022 走看看