Been looking for some code samples, but couldn't find any that match what I'm looking for, sorry. What's the most efficient way to load children nodes into a dropdown list in a .net macro?
For example, I can do:
Node myNode = new Node(1136); Nodes myNodeSubpages = myNode.Children;
foreach (Node nodeValue in myNodeSubpages) {
// do my drop down list magic here with nodeValue.Name
}
Is there a better way that doesn't require me hardcoding the node id into it?
Could someone share a way to use XPathNavigator to load info of my "mainContent" node in C#? Which way is more efficient?
Guess that's kind of pertinent. We're running Umbraco 4.5.1, .net 3.5 on Win Server 2003 pulling from a SQL Server 2005 and everything is working well and is very quick. I don't want to include any latency when I start programming code, so I'm looking to do efficient code upfront, instead of coming back to fix old code. This drop down will be displayed in the front end, similar to a node navigation drop down. Want to jump to August 2010's content quickly? Pick it in the drop down.
Newbie - best way to load nodes into a dropdown?
Been looking for some code samples, but couldn't find any that match what I'm looking for, sorry. What's the most efficient way to load children nodes into a dropdown list in a .net macro?
For example, I can do:
Node myNode = new Node(1136);
Nodes myNodeSubpages = myNode.Children;
foreach (Node nodeValue in myNodeSubpages)
{
// do my drop down list magic here with nodeValue.Name
}
Is there a better way that doesn't require me hardcoding the node id into it?
Could someone share a way to use XPathNavigator to load info of my "mainContent" node in C#? Which way is more efficient?
Thanks,
- Al
In what context are you displaying your dropdown? front end? back office? and are you having specific issues relating to performance?
You don't want to hardcode the parent Id - so you'll need to answer the questions above to allow us to help you out.
As always, please include the version of Umbraco you are using plus OS/DB in case there are any version specific quirks to be aware of.
Guess that's kind of pertinent. We're running Umbraco 4.5.1, .net 3.5 on Win Server 2003 pulling from a SQL Server 2005 and everything is working well and is very quick. I don't want to include any latency when I start programming code, so I'm looking to do efficient code upfront, instead of coming back to fix old code. This drop down will be displayed in the front end, similar to a node navigation drop down. Want to jump to August 2010's content quickly? Pick it in the drop down.
Thanks!
To get the current node i beleive this you would need to use the nodeFactory
In your case
Hope that helps
Tom
is working on a reply...