ASP.NET:ASP:LinkBut​​ton的禁用了javascript? [英] ASP.NET: asp:LinkButton with Javascript disabled?

查看:143
本文介绍了ASP.NET:ASP:LinkBut​​ton的禁用了javascript?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 ASP:LinkBut​​ton的,因为它看起来像一个链接,但也有服务器端Click处理程序

i want to use an asp:LinkButton, since it looks like a link, yet also has server-side Click handler.

但web服务器似乎无法如果JavaScript客户端上禁用检测,并没有呈现到目前仍然可以工作的机制。

But the web-server seems unable to detect if javascript is disabled on the client, and doesn't render into a mechanism that still works.

是否有可能有一个链接,看起来像一个链接,但有服务器端onclick事件处理程序?

Is it possible to have a link that looks like a link, but has server-side OnClick event handler?

答案是否定的,但下面是一些解决方法的想法。接受一个与非零向上票

The answer is no, but below are some workaround ideas. Accepted the one with non-zero up-votes.

推荐答案

您可以使用CSS样式按钮,看起来像一个环节,但是这将是非常依赖于浏览器,根据不同的CSS实现。

You could use CSS to style a button to look like a link, but this will be very much browser dependant, depending on the CSS implementation.

编辑:我觉得有必要来完成我的答案,因为它已经接受

I feel compelled to complete my answer since it's been accepted.

这是 ASP:LinkBut​​ton的渲染HTML链接,因此不能上传以网页;但只能使获得请求。要解决此MS使用JavaScript来操作岗位。这是不可能的但是如果禁用JavaScript。

An asp:LinkButton renders to an HTML link, and as such cannot post to a web page; but can only make get requests. To work around this MS use JavaScript to action the post. This is not possible however if Javascript is disabled.

ASP:按钮 ASP:ImageButton的是不同的。他们张贴到网页提交HTML表单(或取决于窗体属性得到)通过使用真正的HTML表单元素。因此,这些都无需JS干预。

asp:Button and asp:ImageButton are different. They submit the HTML form by posting to a web page (or get depending on the form attributes) by using true HTML form elements. So these will work without JS intervention.

有些浏览器将允许CSS样式的样式按钮,看起来像一个环节,因此这可以用来解决此问题。

Some browsers will allow CSS styling to style a button to look like a link, and as such this can be used to work around the issue.

这篇关于ASP.NET:ASP:LinkBut​​ton的禁用了javascript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆