I've been scratching my head at the ASP.NET 2.0 TreeView control. This control is meant to show a tree of items and each item can have a link to it. For example, this is what I use for my menu on the left of the page.
But it didn’t work. What was happening was that the control expected to navigate away from the current page, so selecting the item in the control did not matter. It simply ignored the “selection” process.
It was time to dig out Lutz Roeder’s Reflector to see what the TreeView was doing. I dove pretty deep into the actual rendering code of each node. I thought I was stuck or perhaps was going to having to cruft up some nasty hack using reflection to specify a NagivateUrl that would do the selection for me. That’s when I saw it. In the code, if you specify a Target for the node (or the entire TreeView) it will make the Selection code happen.
Why does it do this? It works this way because if the Target of the NavigateUrl is not the current page (e.g. Target=_blank or Target=SomeFrame), then the page isn’t going to change. Therefore, it needs to mark the current item as selected.
<SelectedNodeStyle Font-Bold="True" />
Not an elegant solution, but a workable one.
|Building a Web App with ASP.NET Core, MVC6, EF Core, Bootstrap and Angular (updated for 2.0)|
|Using Visual Studio Code for ASP.NET Core Projects (new)|
|Implementing and Securing an API with ASP.NET Core|
|Building a Web App with ASP.NET Core, MVC6, EF Core and AngularJS|
|Building a Web App with ASP.NET5, MVC6, EF7, and AngularJS (Retired)|
|Best Practices in ASP.NET: Entities, Validation, and View Models|
|Front-End Web Development Quick Start|
|Lessons from Real World .NET Code Reviews|
|Node.js for .NET Developers|
|Application Name||WilderBlog||Environment Name||Production|
|Application Ver||22.214.171.124||Runtime Framework||.NETCoreApp,Version=v2.0|
|App Path||D:\home\site\wwwroot\||Runtime Version||.NET Core 4.6.26020.03|
|Operating System||Microsoft Windows 10.0.14393||Runtime Arch||X86|