- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的中继器中有一系列用于切换页面的链接按钮
<asp:Repeater ID="rptPageLinks" runat="server"><ItemTemplate>
<asp:LinkButton ID="lnkNewPage" runat="server" Text='<%# Eval("Page") %>'
OnCommand="SomeEventHandler" CommandArgument='<%# Eval("Page") %>' CommandName="Redirect"
OnClientClick="return confirm('Do you want to save your chanes before you navigate to a new page?');" />
</ItemTemplate></asp:Repeater>
我想要做的是将 OnClientClick 的结果传递到 EventHandler 中,理想情况下通过更改 CommandName (即,如果他们在确认上单击"is",则将 CommandName 更改为“SaveAndRedirect”,如果他们单击“不”,它保留为“重定向”)。
有人可以帮忙吗?如果可以的话谢谢。
最佳答案
不幸的是,你所要求的那样是不可能的。 OnCommand 是 ASP 控件的 ASP.Net 服务器端属性。在客户端上渲染后,您只能使用客户端 html。
但是,解决方案是将确认对话框的值保存到命令事件的隐藏字段中,然后在命令中读取该值。为此,我建议如下:
<script type="text/javascript">
function confirmSave() {
document.getElementById('confirmChoice').value=confirm("Do you want to save your changes...");
}
</script>
<input type='hidden' id='confirmChoice' runat="server" />
然后,在命令事件调用的代码后面的页面中,您可以访问设置到隐藏字段中的值。
关于javascript - ASP.NET - 使用 Javascript 在 LinkButton 上编辑 CommandName,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3871371/
我正在开发一个 SMS 网关,我在考虑我应该在其中实现的功能。因此,我查看了一些 SMS 网关(SMSNOW、SMS studio 和 Ozeki)作为示例。 我几乎完成了实现,但我遇到了几乎所有 S
我想知道是否有一些好的网络解决方案来显示“巨大数据集”的图表,我已经尝试过 amcharts 和 Highcharts Stock(jquery 解决方案)但没有成功。 一开始他们在工作,但此刻“ch
我遵循TON installation guide并在最后一步遇到错误: cmake --build . --target test-lite-client tests.cpp:37:59: erro
我重新安装了 4-5 次 Eclipse Neon(最新版)并下载了以下 SDK: SDK 平台 API 24 Re。 1 SDK 平台 API 8 修订版 3 Android SDK 工具修订版 2
我的应用程序使用 Facebook 登录。我添加了 pod 和所有这些步骤,但是当我编译该项目时,我收到了超过 150 个警告。在 Podfile 中: 平台:ios,'10.2' ………… pod“
这些类型的问题一毛钱一打,我查阅了一个又一个资源,但似乎没有任何效果: https://github.com/nodejs/node-gyp/issues/629 NodeJS - Error ins
我正在 Android 中编写一个有点复杂的游戏引擎。 目前我有一个用于更新子系统的线程。 update方法内部是根据当前游戏状态更新游戏逻辑的方法。 游戏状态有一个场景,已更新。场景由根节点组成,形
我一直在尝试在使用 Jackson 2.2.2 作为 Json (de)serializer 的 Spring MVC 3.1.2 应用程序之上开发一个 RESTful 层。问题是,它对引用的影响太深
我有一个正在运行的 Symfony2 应用程序,它使用相同的代码库,但不同的环境名称映射到不同的数据库。 例如: foo.example.com --> 使用环境 foobar.example.com
我正在尝试设置 socket.io,但我 90% 确定遇到了问题。我正在运行我的服务器,它说它已连接,然后我在 2-3 秒后收到一堆新客户端。这是我的终端输出: 21 Dec 17:36:53 - s
我是一名优秀的程序员,十分优秀!