在asp.net中启用禁用菜单选项 [英] Enable disable menu option in asp.net

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

问题描述





如何启用和禁用菜单项中的按钮以进行插入和更新:

例如我插入了一些通过asp.net页面在数据库中记录现在插入一些记录现在插入菜单选项中的buttton被禁用并且编辑按钮被启用

解决方案

如果你是尝试从服务器端代码执行此操作,就像调用

  //  禁用插入按钮。 
InsertButton.Enabled = false ;

现在,如果您正在尝试这是来自JavaScript,你想要做这样的事情(假设你正在使用jQuery)

  //  禁用插入按钮 
<%= InsertButton.ClientID %> .attr( disabled'' disabled');
// 启用
<%= InsertButton.ClientID %> .removeAttr(' disabled');


Hi,

How can i enable and disable button in menu items for insert and update :
for example i had insert some record in the database via asp.net page now some record is inserted now insert buttton in the menu option gets disabled and edit button gets enabled

解决方案

If you''re trying to do this from server side code, it''s as simple as calling

// Disable the insert button.
InsertButton.Enabled = false;

Now if you''re trying to do this from JavaScript, you''d want to do something like this (assuming you''re using jQuery)

// Disable the insert button
<%= InsertButton.ClientID %>.attr('disabled','disabled');
// Enable it
<%= InsertButton.ClientID %>.removeAttr('disabled');


这篇关于在asp.net中启用禁用菜单选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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