asp.net btn控件禁用问题 [英] Asp.net btn control disable problem

查看:67
本文介绍了asp.net btn控件禁用问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

protected void Button1_Click(object sender, EventArgs e)
    {
        Button1.Enabled = false;
        
        view();

        enable();
       
        
    }


public void view()
{
//here i wrote code to dispaly record in excel
}
public void enable()
{
Button1.Enabled = true;
}


以上声明Button1.Enabled = false;不禁用btn

Button1.Enabled = true;不启用btn

当btn cleck事件调用
Button1.Enabled =假;
该语句不会执行,因此btn不会禁用
查看执行该编写代码的方法调用
然后启用方法调用
Button1.Enabled = true;
语句也未执行.


above statment Button1.Enabled = false; not disable the btn

Button1.Enabled = true; not enable the btn

when btn cleck event call
Button1.Enabled = false;
this statement does not execute so btn not disable
view method call underthat written code executed
then enable method call now
Button1.Enabled = true;
statement also not executed .

推荐答案

您的问题是什么,您想要什么?
看看您的代码在做什么

当您单击button1
Buuton1将被禁用.
您的View方法被调用.
现在,您正在调用Enable方法,现在已启用Button1.

您的代码没有问题,可以在编写时使用.
现在您真正想要的是什么?
What is your problem and do you want?
See what your code doing

When you click button1
Buuton1 will be Disable.
Your View method is called.
Now you are calling Enable method ,Button1 is now enabled.

your code have no problem, It works as you write.
now what you want really?


这篇关于asp.net btn控件禁用问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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