【发布时间】:2012-12-21 05:03:30
【问题描述】:
我有一个 jqgrid 和按钮图像列,看起来像这样:
按钮 |样品1 |红色
按钮 |样品2 |蓝色
按钮 |样品3 |红色
按钮 |样品4 |红色
按钮 |样品5 |蓝色
按钮 |样品6 |绿色
需要做的是:
如果用户的会话 id 为红色 Session["Color"] = red;
那么所有不是红色的按钮都将被禁用。 与其他颜色相同。
但如果会话颜色不存在。它只会隐藏列
这是我的示例代码:
var sessionColor = '<%=Session["Color"]%>';
if (sessionColor == 'red') {
// code here
// hide button green and blue
}
if (sessionColor == 'green') {
// code here
// hide button red and blue
}
if (sessionColor == 'blue') {
// code here
// hide button gren and blue
}
else { //hide all button}
问题:如果具有“红色”会话的用户将登录,我将如何禁用该按钮。
【问题讨论】:
-
我不知道如何禁用/隐藏按钮。如果它包含“红色”
-
使用按钮Collection方法,并且button.Visible = true;和 button.Visible = false;确实是代码/
-
有用的问题我为此添加了 +1