如何在asp.net中禁用默认按钮 [英] How to disable default button in asp.net

查看:59
本文介绍了如何在asp.net中禁用默认按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何禁用asp.net中的默认按钮

How to disable default button in asp.net

推荐答案

我不知道默认按钮是什么意思,但你可以按如下方式禁用按钮:



按钮定义:

I dont know what do you mean by default button,but you can disable button something as follows:

Button definition:
<asp:button id="btn" runat="server" text="Redirect" />



代码背后:


In Code Behind:

btn.Attributes.Add("onclick","return Redirectfunc();");



在页面的head部分写下以下函数:


Write the following function in the head section of your page:

function Redirectfunc()
{
  document.getElementById('btn').disabled = true;
  window.location.href="http://www.google.com"; 
  return true;
}





问候......:笑:



Regards.. :laugh:


< asp:button id =btnrunat =servertext =Redirectenabled =false/>
<asp:button id="btn" runat="server" text="Redirect" enabled="false" />


我认为这是你正在寻找的......

button1.Enabled = false;
I think this is wat u are looking for..
button1.Enabled=false;


这篇关于如何在asp.net中禁用默认按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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