How-to: Hide expand button when there are no child nodes existed during WebTreeView’s load-on-demand operation

We have added a new KB article about how to hide expand (+) sign button in certain node that has no child nodes during WebTreeView’s load-on-demand operation.

By default, the expand button will be rendered along with the child nodes regardless whether a node has a child. This behavior sometimes confuses the user as they cannot see which node has child and vice versa.

To perform the above scenario, you can simply add 2 lines of code in InitializeNode server side event, like following:

protected void WebTreeView1_InitializeNode(object sender, WebTreeViewNodeEventArgs e)
{
  
if (e.Node.Nodes.Count == 0)
  
e.Node.ChildNodeExpandable = false;
}

When you run the project, it will look like following:

Hide Expand Button

The sample is available to be downloaded in here.

For more information on this article, you can refer to Intersoft’s support site on the following link:
http://support.intersoftpt.com/KBArticle.aspx?aid=256

Cheers,
Martin Lie.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s