Show/hide .asp controller with C#

Go To


In an online tutorial I am following I have been given a task I can't get my head around. The task is to make a setting in LINQ (done), make an .asp controller (done) and programatically make the setting either Show/Hide the content of the .asp controller. So my question is, how do I make the controller show/hide with C#? I had some help making the setting for LINQ, and the start of the C# as shown, but I'm not sure how to finalize it. Any help is appreciated.

I am self thought and started programming about 2 weeks weeks ago so you have to excuse me for any obvious answers.


Source code:

private bool isShowNyhetsMail()
        bool value;
        return (!bool.TryParse(App.Setup.GetSettingValue(CategoryName.Edm, SettingName.ShowNyhetsMail), out value)) ? true : value;

        CheckBox_Nyheter.Visible = isShowNyhetsMail();

.asp controller

<mc:McCheckBox ID="CheckBox_Nyheter" runat="server" TabIndex="25" Text="<%$ Resources:CUSTOMER_REGISTRATION, Check_NewsOffers %>" ResourceObject="CUSTOMER_REGISTRATION" ResourceName="Check_NewsOffers" />
2012-04-04 06:26
by Lindberg
which asp controller are you speaking about - ganesshkumar 2012-04-04 06:30
what's your question? what do you want to show/hide - Ali Issa 2012-04-04 06:34
I want to hide an .asp controller called "CheckBox_nyheter". My question is, how do I make this happen? Thank - Lindberg 2012-04-04 08:53
I suppose Op means server control by controller - adt 2012-04-04 08:57
As adt said, its a server controll. Sorry for making this a bit hard to understand but here is link of the controller: Lindberg 2012-04-04 09:12
You are making a recursive call to isShowNyhetsMail, that's at least a part of the problem - Vinzz 2012-04-04 09:19


The line

CheckBox_Nyheter.Visible = isShowNyhetsMail();

Won't be executed since there is a return statement before that.

2012-04-04 09:19
by Euclides Mulémbwè


The statements after the return statement will not be executed. Use that particular statement before return.

2012-04-05 10:38
by Rajamohan Anguchamy