我无法更改控件对C#代码的可见性 [英] I cannot change control's visibility on C# code

查看:174
本文介绍了我无法更改控件对C#代码的可见性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想更改C#上的控件可见性,但没有任何反应。控件在AspxPopupControl中,其中3个在设计时被隐藏,其中1个是可见的。我使用这段代码来显示他们

I want to change controls visibility on c#, but nothing happens. The controls are in an AspxPopupControl and 3 of them are hidden in design time, 1 of them is visible. I use this code to visible them

if (paramType == "Grup")
            {
                gv_Answers.Visible = false;
                trlGroup.Visible = true;
                chkShowItems.Visible = true;

            }
            else
            {
                gv_Answers.Visible = true;
                trlGroup.Visible = false;
                chkShowItems.Visible = false;
            }

此代码位于gridview的CustomCallBack事件中。所以我不知道该怎么做。这是一件容易的事情,但我无法处理。

This code is in a CustomCallBack event of a gridview. So i don't know what to do from this point. It's an easy task but i couldn't handle it.

感谢您的帮助

推荐答案

这个问题的原因是您正在ASPxGridView的回调中更改控件的可见性。回调响应仅包含有关发起回调及其子控件的控件的信息。由于ASPxPopupControl不是GridView的一部分,所以出现问题。最简单的解决方案是在PostBack事件中实现此代码,而不是回调。在这种情况下,一切都会正常工作。

The cause of this problem is that you are changing the control's visibility within the ASPxGridView's callback. The callback response contains only the information about control who initiated the callback and its child controls. Since the ASPxPopupControl is not a part of the GridView, the problem appears. The easiest solution is to implement this code within a PostBack event, not a callback. In this case, everything will work correctly.

这篇关于我无法更改控件对C#代码的可见性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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