This is a migrated thread and some comments may be shown as answers.

NodeClick not fired

5 Answers 151 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Martín
Top achievements
Rank 1
Martín asked on 29 Apr 2008, 04:32 AM
Hello All,

I've found out (the hard way) that NodeClick event is not raised when the page containing the treeview has EnableViewState = false.
Is this a bug? I think it migth be since other events like NodeDataBound and ContextMenuItemClick are raise normally.

Thanks,

Martín

5 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 01 May 2008, 08:15 AM
Hello Martín,

Please find attached an example which demonstrates how to use RadTreeView with disabled view state.

All the best,
Albert
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Martín
Top achievements
Rank 1
answered on 02 May 2008, 06:35 AM
Albert,

Thanks for your example, it surely works but I when I link the tree to an AccessDataSource (try tree.mdb from the examples) that the problem appears.  I will gladly upload an example app showing this if needed.

Thanks,
          Martín
0
Atanas Korchev
Telerik team
answered on 02 May 2008, 07:43 AM
Hi Martín,

Indeed when binding to declarative sources RadTreeView will not raise the NodeClick event. This occurs due to the way declarative databinding works. It occurs later than the moment when postback events are processed and as a result the treeview is still empty. To force earlier databinding you should call the DataBind method of the treeview during the PageLoad event:

protected void Page_Load(object sender, EventArgs e)
{
    RadTreeView1.DataBind();
}

Regards,
Albert
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
fquinty
Top achievements
Rank 1
answered on 29 Aug 2008, 09:19 PM
hello,

I have the same problem . i would like to put EnableViewState=false to my RadTreeView but the onNodeEdit event does not raised.

My RadTreeView is loaded manually on Server side during Page_Load.

When a node has been edited, I would like to use the onNodeEdit event , to update some data and then load the RadTreeView . Here is a sample code to explain my scenario:

<telerik:RadTreeView ID="TreeViewFolder" runat="server" EnableViewState="false" Skin="Outlook" AllowNodeEditing="true" OnNodeEdit="TreeViewFolder_NodeEdit">

</telerik:RadTreeView>

Code-Behind (VB.NET) :

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

If Not IsPostBack Then

TreeViewBuild()

End If

End Sub

Sub TreeViewBuild()

Dim nodeMailBox As RadTreeNode

nodeMailBox =

New RadTreeNode("aaaa")

TreeViewFolder.Nodes.Add(nodeMailBox)

nodeMailBox =

New RadTreeNode("bbbb")

TreeViewFolder.Nodes.Add(nodeMailBox)

TreeViewFolder.DataBind()

End Sub

Protected Sub TreeViewFolder_NodeEdit(ByVal sender As Object, ByVal e As RadTreeNodeEditEventArgs)

Dim nodeEdited As RadTreeNode = e.Node

Dim newText As String = e.Text

TreeViewBuild()

End Sub



This code runs fine if EnableViewState=true (except the RadTreeView is duplicated)


Any idea?

Thanks for your help

Regards,

Frank Quinty

0
Atanas Korchev
Telerik team
answered on 01 Sep 2008, 11:28 AM
Hi fquinty,

You should populate the treeview on every page load because you have disabled the viewstate. Just always call the TreeViewBuild method in Page_Load.

Regards,
Albert
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
TreeView
Asked by
Martín
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Martín
Top achievements
Rank 1
fquinty
Top achievements
Rank 1
Share this question
or