I don't know what happened, we had it working but with some UI changes, it stopped working properly. So, I tried to create a new file, to rule out all the CSS, and to isolate just the RadTreeView and it's still not behaving as expected. Here's what I have in the .aspx page.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SearchForm.aspx.cs" Inherits="Cnet_Forum.SearchForm" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<telerik:radscriptmanager runat="server" id="RadScriptManager1">
<Scripts>
<asp:ScriptReference Assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Name="MicrosoftAjax.js" Path="https://ajax.microsoft.com/ajax/4.0/MicrosoftAjax.js" />
</Scripts>
</telerik:radscriptmanager>
<div>
<div class="panel-expand">
<telerik:RadTreeView ID="area_tree_view" runat="server" runat="server" CheckBoxes="True" TriStateCheckBoxes="True"
CheckChildNodes="true" MultipleSelect="True" >
</telerik:RadTreeView>
</div>
</div>
</form>
</body>
</html>
And the code-behind page:
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DbforumData;
using DbforumData.dataset;
using Telerik.Web.UI;
namespace Cnet_Forum
{
public partial class SearchForm : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string db = ConfigurationManager.ConnectionStrings["db"].ConnectionString;
CandidateDataSource datasource = new CandidateDataSource(db);
FunctionGroupDataSet functionset = datasource.GetFunctionGroup();
datasource.Dispose();
LoadSubjectGrid(functionset);
}
protected void LoadSubjectGrid(FunctionGroupDataSet functionset)
{
DataRow[] results;
var view = area_tree_view;
RadTreeNode groupNode, functionNode;
foreach (var grouprow in functionset.FunctionGroup) // the parent node
{
results = functionset.Function.Select("parentNodeId = " + grouprow.function_group_id);
groupNode = new RadTreeNode(grouprow.function_group_name, grouprow.function_group_id.ToString())
{
Expanded = false,
Checkable = true
};
view.Nodes.Add(groupNode);
foreach (DataRow functionRow in results) //the chile nodes
{
functionNode = new RadTreeNode((string)functionRow["childNodeName"], Convert.ToString(functionRow["childNodeId"]));
groupNode.Nodes.Add(functionNode);
}
}
}
}
}
Obviously you can't run it because it requires db connection but you get the idea.