CS Nuggets

This blog is for addons, bugs, fixes, and issues pertaining to Community Server.

CS2007: New Feature: DisableAutomatedVisible

This new feature requires changes to the SDK and allows you to override the protected AutomatedVisible property of any control that derives from the CommunityServer.Controls.WrappedContentBase class.  The AutomatedVisible property is controlled internally by controls with internal rules that control their visibility.

A good example of this is CommunityServer.Blogs.Controls.WeblogPostData control and the LinkTo property.  If the item to link to doesn't exist, instead of just not providing a link the entire control is not rendered.  In some cases you may want to do this, but in others you may not.  The CommentCountBox in blog lists does this and won't display the number of comments or the resource text if comments are disabled and no comments exist.  I thought that this looked sort of funky, thus the reason I created this feature.

To add this feature:

File: CommunityServerControls20/Base/WrappedContentBase.cs:

Around line 155:

Insert the following:

public bool DisableAutomatedVisible
{
 get { return (bool)(ViewState["DisableAutomatedVisible"] ?? false); }
 set { ViewState["DisableAutomatedVisible"] = value; UpdateVisible(); }
}

Around line 232:

Change the following line from:

base.Visible = ((bool)(ViewState["Visible"] ?? true)) && this.AutomatedVisible;

to:

base.Visible = ((bool)(ViewState["Visible"] ?? true)) && (this.AutomatedVisible || this.DisableAutomatedVisible);

Posted: Sun, Apr 22 2007 01:52 PM by Bill Bosacker | with no comments
Filed under: ,
Leave a Comment

(required) 

(required) 

(optional)

(required)