开发者

controls visibility in C#

开发者 https://www.devze.com 2023-01-18 17:06 出处:网络
How to make acontrol visibilty to true or false. currently i am setting a panel control visibility like this in code behind. i am comparing the values of Username and UserId. If both the values are sa

How to make a control visibilty to true or false. currently i am setting a panel control visibility like this in code behind. i am comparing the values of Username and UserId. If both the values are same..i am setting panel visibility to false

               if (UserName == UserID))
                {
                    pnl_linkbuttons.Visible = false;
                }

is there any alternative 开发者_开发百科way to set the control visibility in C# from code behind.

Thanks in advance.


pnl_linkbuttons.Visible = UserName == UserID;


if you are using asp.net you could use jQuery or javascript, but if youre working in windows forms you pretty much need to use C#.

if you were in silverlight or wpf you could set the visibility using XAML.

try this link for reference if youre in XAML... How can you get a XAML TextBlock to collapse when it contains no data?

or here in MSDN... http://msdn.microsoft.com/en-us/library/system.windows.trigger.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号