如何在使用相同页面进行更新和插入时禁用按钮 [英] How to Disable button when same page is used for update and insert

查看:81
本文介绍了如何在使用相同页面进行更新和插入时禁用按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在编辑模式下打开fom时使用禁用保存按钮。我使用相同页面插入和更新..

I want to use disable Save button when fom is opened in edit mode.,I am using Same page to insert and update..

推荐答案

你可以把编辑模式检查的一个属性和后面的代码使一个方法DisplayLogic

在页面加载中调用该方法。或任何你想要的地方。根据你的逻辑,将按钮属性btn.visible设置为false和true。
You can put one property for the edit mode check and in code behind make one methods DisplayLogic
call that method in page load. or anywhere you want. just put the button property btn.visible to false and true according to your logic.


Hii

我找到了解决方案



Hii
I am found the solution

protected void Page_Load(object sender, EventArgs e)
     {
         if (!IsPostBack)
         {

             if (Session["id"] != null && Session["id"].ToString().Length > 0)
             {
                 bindtxtbx();
                 btnSave.Enabled = false;
             }
             else
             {
                 btnUpdate.Enabled = false;
             }


         }
     }


你好,

简单使用 btn.Enabled = True 启用

btn.Enabled = False 根据您的要求禁用按钮。



谢谢
Hello ,
Simple use btn.Enabled=True to Enable
and btn.Enabled=False to Disable the button according to your requirement .

thanks


这篇关于如何在使用相同页面进行更新和插入时禁用按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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