System.Data.DataTable dt = Node.GetCurrent().ChildrenAsTable(); System.Data.DataView dv = new System.Data.DataView(dt); dv.RowFilter = "YOUR FILTER EXPRESSION"; // Bind the DataView to the DropDown
None of these work.. any ideas? The datatype for the [Date] field is date datatype. Needs to work irrespective of date/international settings of server.
Querying Umbraco nodes
On my site I have a dropdown on a .net control , I'd like to populate this with child nodes that.
1. Where the EventDate is current (greater than today)
2. Where the child node is not hidden.
EventsNode.ChildrenAsTable(); - will get the children but how do I restrict the children by my criteria?
You can use a DataView instead of the DataTable
hth, Thomas
If the EventDate is held as a date - can I filter like this:
dv.RowFilter = "[EventDate] > " + DateTime.Today.ToString();
hmmm cant seem to get the date filtering working..
// [Date] = The name of the field , not the alias as required.
dv.RowFilter = "[Date] > " + DateTime.Today.ToString();
dv.RowFilter = "[Date] > '" + DateTime.Today.ToString() + "'";
None of these work.. any ideas? The datatype for the [Date] field is date datatype. Needs to work irrespective of date/international settings of server.
I think you could do something like this:
Thanks,
Nik
is working on a reply...