Click here to Skip to main content
15,900,815 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I have used a tree view in my project, in which i have populated the treeview through an xml data source.
I want when a tree node is clicked or selected then i will take the url from navigateurl and append some of my query strings.
But when i click a tree node then it is not firing the selected node changed event
and directly going to the url in the navigateurl

Any Help
Posted
Comments
Timberbird 25-May-11 7:52am    
What do your node items represent? Aren't they links to some other page?
TanzeelurRehman 25-May-11 7:55am    
In the node url field i have kept the url of the destination page but i want to append a query string with the url, thats why i need to fire the selectednode changed event, but it is not firing, it moves directly to the url specified in the navigate url field
Timberbird 25-May-11 8:10am    
That may be by design if NavigateURL property is set. Check this
TanzeelurRehman 25-May-11 8:18am    
It seems that the link which you have sent is in russian language
Timberbird 25-May-11 9:01am    
Sorry, my bad. Here it goes: TreeNode.NavigateUrl

1 solution

Do not fill NavigateUrl field then - consider adding URL into TreeNode.Value field instead (I believe it may be done via editing DataBindings of your TreeView) and in your SelectedNodeChanged handler use, for example, Page.Server.Transfer()
 
Share this answer
 
Comments
TanzeelurRehman 26-May-11 3:47am    
I have tried already that way, but problem is that it is giving error, when the tree node is clicked.
Timberbird 26-May-11 4:00am    
What kind of error is it?
TanzeelurRehman 26-May-11 4:31am    
Error Source

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.




Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) +24
System.Xml.XmlDocument.Load(XmlReader reader) +114
System.Web.UI.WebControls.XmlDataSource.PopulateXmlDocument(XmlDocument document, CacheDependency& dataCacheDependency, CacheDependency& transformCacheDependency) +239
System.Web.UI.WebControls.XmlDataSource.GetXmlDocument() +156
System.Web.UI.WebControls.XmlHierarchicalDataSourceView.Select() +17
System.Web.UI.WebControls.TreeView.DataBindNode(TreeNode node) +133
System.Web.UI.WebControls.TreeView.PerformDataBinding() +307
System.Web.UI.WebControls.HierarchicalDataBoundControl.PerformSelect() +99
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
System.Web.UI.WebControls.TreeView.DataBind() +4
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +66
System.Web.UI.WebControls.TreeView.OnPreRender(EventArgs e) +45
System.Web.UI.Control.PreRenderRecursiveInternal() +103
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496
Timberbird 26-May-11 4:41am    
Check this page - something's wrong with the DataSource

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900