立即禁用服务器端asp.net按钮?

编程入门 行业动态 更新时间:2024-10-28 10:24:27
本文介绍了立即禁用服务器端asp按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

您好。 我已阅读很多关于禁用提交按钮的帖子,但我无法获得 这些答案可以解决我的问题。 我有一个服务器端的asp按钮,在按钮下我有代码 后面做了一些简单的处理,然后是一个 response.redirect。 当用户点击此按钮时,我希望 按钮立即显示为 ghosted / grayed out / disabled,就像一个 典型的禁用按钮,然后继续执行 处理后面的代码,然后是response.redirect 我尝试过的其中一件事就是在客户端使用javascript 来禁用按钮,但这会产生停止所有代码的效果 在服务器内部运行按钮单击事件处理程序。 有人能解决这个困境吗? TIA,dnw。

解决方案

为什么不把它放在DIV中并在点击按钮时隐藏div - 问候 John 点网工作 <做*** @ hotmail>在消息中写道 news:77 ************************** @ posting.google.c om ...

你好。 我读了许多关于禁用提交按钮的帖子,但是我无法得到这些答案来解决我的问题。我有一个服务器端的asp按钮,在按钮后面我有代码后面做一些简单的处理,然后是 response.redirect。 <当用户点击此按钮时,我希望按钮立即显示为幻影/灰显/禁用,就像典型的禁用按钮一样,然后继续执行处理后面的代码,然后是response.redirect 我尝试做的事情之一是放入客户端javascript 来禁用按钮,但这有效果停止所有代码运行服务器按钮单击事件处理程序。 任何人都可以解决这个困境吗? TIA,dnw。

您好。 结果非常有趣! 如果asp按钮没有服务器端事件点击处理程序,那么你的 建议效果很好! 如果asp按钮有一个服务器端事件点击处理程序,即使有这个处理程序中的绝对没有代码,你的建议也不会隐藏 div(后来没有隐藏按钮。) 不幸的是,我需要在asp按钮内部处理代码点击 处理程序! -dnw。 ***通过开发人员指南 http:// www。 developersdex *** 不要只是参加USENET ......获得奖励!

我已经设法找到了解决方案,虽然它不是一个干净且优雅的 。 有一个asp按键和一个HTML按钮 在代码页面后面的init处理程序: aspnetbutton.Attributes.Add(" onClick"," javascript :func();") 在HTML部分内: 对于html按钮,请设置它的风格属性: 可见性:隐藏;禁用类型="按钮" 对于名为func()的javascript函数: 函数func() { document.getElementById(''aspnetbutton'')。style.visi bility =''hidden''; document.getElementById(''html button' ')。style.visibility =''visible''; } 基本上,当用户点击asp按钮时,客户端 函数被调用,它隐藏了aspnet按钮,并使html 禁用按钮可见。 诀窍是将隐藏的html按钮放在完全相同的 位置作为可见的asp按钮,以便它们在设计上重叠 时间。 实际上,我不知道为什么我现在很难隐藏DIV,如果我 可以成功隐藏一个asp按钮。 -dnw。 ***通过Developersdex发送 www.developersdex *** 不要只是参加USENET ......获得奖励!

Hello. I''ve read many posts about disabling submit buttons, but I can''t get these answers to solve my problem. I have a server side asp button, and under the button I have code behind that does some simple processing, followed by a response.redirect. When the user clicks on this button, I would like the button to instantly appear to be "ghosted / grayed out / disabled", like a typical disabled button, then carry on and do the code behind processing, followed by the response.redirect One of the things I tried doing was putting in client side javascript to disable the button, but that had the effect of stopping all code running inside the server button click event handler. Can anyone solve this dilemna please? TIA, dnw.

解决方案

Why dont you put it in a DIV and hide the div when the button is clicked -- Regards John "Dot net work" <do***@hotmail> wrote in message news:77**************************@posting.google.c om...

Hello. I''ve read many posts about disabling submit buttons, but I can''t get these answers to solve my problem. I have a server side asp button, and under the button I have code behind that does some simple processing, followed by a response.redirect. When the user clicks on this button, I would like the button to instantly appear to be "ghosted / grayed out / disabled", like a typical disabled button, then carry on and do the code behind processing, followed by the response.redirect One of the things I tried doing was putting in client side javascript to disable the button, but that had the effect of stopping all code running inside the server button click event handler. Can anyone solve this dilemna please? TIA, dnw.

Hello. The result is very interesting! If the asp button has no server side event click handler, then your suggestion works great! If the asp button has a server side event click handler, even if there is absolutely no code inside this handler, your suggestion does not hide the div (and subsequently does not hide the button.) Unforunately, I need code behind processing inside the asp button click handler! -dnw. *** Sent via Developersdex www.developersdex *** Don''t just participate in USENET...get rewarded for it!

I have managed to find a solution, although it is not a clean and elegant one. Have an asp button and an html button Inside the code behind page init handler: aspnetbutton.Attributes.Add("onClick", "javascript: func();") Inside the HTML section: For the html button, set it''s style property: VISIBILITY: hidden; disabled type="button" For the javascript function called func(): function func() { document.getElementById(''aspnetbutton'').style.visi bility=''hidden''; document.getElementById(''html button'').style.visibility=''visible''; } Basically, when the user clicks on the asp button, the client side function gets called, and it hides the aspnetbutton, and makes the html disabled button visible. The trick is to position the hidden html button in exactly the same place as the visible asp button, so that they overlap at design time. Actually, I''m not sure why I had difficulty in hiding the DIV now, if I can successfully hide an asp button. -dnw. *** Sent via Developersdex www.developersdex *** Don''t just participate in USENET...get rewarded for it!

更多推荐

立即禁用服务器端asp.net按钮?

本文发布于:2023-11-24 21:37:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1626937.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:服务器端   按钮   asp   net

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!