Hello,
I have a treeview that initially loaded and populated all nodes. Obivously not good for scaling, so I've moved towards serverSide nodeExpand onDemand. This works nice, but I've noticed my nodeClick isn't firing now.
There is a plus sign on the node, can I not have nodeExpand be fired only when that + is clicked? And if the text/label is clicked have nodeClick fire?
I have a treeview that initially loaded and populated all nodes. Obivously not good for scaling, so I've moved towards serverSide nodeExpand onDemand. This works nice, but I've noticed my nodeClick isn't firing now.
There is a plus sign on the node, can I not have nodeExpand be fired only when that + is clicked? And if the text/label is clicked have nodeClick fire?
4 Answers, 1 is accepted
0

Charles
Top achievements
Rank 1
answered on 04 Jul 2013, 08:27 PM
Correction,
the root nodes act ok. But since I'm using ondemand for the expanding nodes, it appears the nodes added (after expanding) don't behave on the onclick.
Initially populated nodes: click and expand work
OnDemand populated nodes: expand only works
the root nodes act ok. But since I'm using ondemand for the expanding nodes, it appears the nodes added (after expanding) don't behave on the onclick.
Initially populated nodes: click and expand work
OnDemand populated nodes: expand only works
0

Charles
Top achievements
Rank 1
answered on 05 Jul 2013, 02:38 PM
here is a sandboxed version which behaves with the same issue. Initially loaded nodes fire onclicks, but nodes I add on-demand don't fire onclicks...
namespace RadTreeView
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
this.BuildTree(TestTreeView.Nodes);
}
TestTreeView.NodeExpand +=
new Telerik.WebControls.RadTreeView.RadTreeViewEventHandler(TestTreeView_NodeExpand);
TestTreeView.NodeClick +=
new Telerik.WebControls.RadTreeView.RadTreeViewEventHandler(TestTreeView_NodeClick);
}
protected void TestTreeView_NodeExpand(object sender, RadTreeNodeEventArgs e)
{
RadTreeNode node = (RadTreeNode)e.NodeClicked;
BuildTree(node.Nodes);
}
protected void TestTreeView_NodeClick(object sender, RadTreeNodeEventArgs e)
{
RadTreeNode node = (RadTreeNode)e.NodeClicked;
}
private void BuildTree(RadTreeNodeCollection ParentNode)
{
for (int i = 0; i < 10; i++)
{
var node = new RadTreeNode("title" + i, "value");
node.ExpandMode = ExpandMode.ServerSideCallBack;
node.NavigateUrl = string.Empty;
node.PostBack = true;
ParentNode.Add(node);
}
}
}
}
0

Charles
Top achievements
Rank 1
answered on 05 Jul 2013, 04:07 PM
This code works fully as expected as soon as I use the latest assemblies. I was using v2. No code change and this works with v4.
Charles
Charles
0

Charles
Top achievements
Rank 1
answered on 05 Jul 2013, 06:16 PM
Well, additionally, it appears that the treeview was using Telerik.Webcontrols. I've switched this to Telerik.Web.UI and did some minor code changes and the treeView works onDemand and asExpected :)
Hopefully someone else finds this useful .
Hopefully someone else finds this useful .