Last post May 31, 2011 02:12 AM by QaziTanzeel
May 25, 2011 06:47 AM|QaziTanzeel|LINK
I have a tree view which i am populating through xml datasource, By the first time when the page opens it opens correctly. when i click on the Treeview node, then this error is happening
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.
[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.TreeView.DataBindNode(TreeNode node) +133
System.Web.UI.WebControls.TreeView.OnPreRender(EventArgs e) +45
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496
May 25, 2011 07:59 AM|KumarHarsh|LINK
show code of treeview click.
put breakpoint there and notice when error is throwing ?
May 26, 2011 09:46 PM|Decker Dong - MSFT|LINK
Show us your codes and point out where the problem happens?
Maybe a screenshot is better
May 27, 2011 03:22 AM|QaziTanzeel|LINK
Thank you brother for your reply
I have used a tree view in my project, in which i have populated the treeview through an xml data source (The xml is also generated dynamically using an xslt).
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 according to my logic.
But when i click a tree node then it is not firing the selected node changed event and goes directly to the url in the navigateurl.
later i modified it as below
i assigned the url in the xml to the value field and left the navigateurl property blank, by the first time when the page is requested then it goes right. when a node in the treeview is clicked then it generates the error as mentioned above.
If possible guide me, otherwise i will send you the code + screenshot
May 31, 2011 01:21 AM|Decker Dong - MSFT|LINK
Your codes and screenshot, please：）
May 31, 2011 01:27 AM|QaziTanzeel|LINK
Thank you brother, i did it using another way
Basically i modified all the navigateurl property value with in databound event of the treeview, now my problem is solved,
but if possible would you please guide me,
When there is url string in the navigateurl field then why selectednode event doesn't fire. Any article which can provide me a grasp on treeview
May 31, 2011 01:51 AM|Decker Dong - MSFT|LINK
If you put a naviagate URL set to the node, when you click the node, it only guides you to where the page locates.
And anyway, I mean that in fact you can set the node's value to the url, and in the SelectedNode event, just use
May 31, 2011 02:12 AM|QaziTanzeel|LINK
Thank you very very very much
Stay blessed ...