Using a c#' user control the following code Lists all child nodes of the current node and populates the dropdownlist with the values but how can I target a specific node of a specific doctype and display those values? It needs to be bullet proof so that it works from anywhere on the website as the search form is in the master template.
public partial class UserControls_ExtendedSearch : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ddlLocation.DataSource = Node.GetCurrent().ChildrenAsList.Select(y =>
{
return new
{
Name = y.Name,
Id = y.Id
};
});
ddlLocation.DataTextField = "Name";
ddlLocation.DataValueField = "Id";
ddlLocation.DataBind();
}
}
}
Hi everyone im really struggling to get this to work and its the final thing holding me back.Im Looking if someone could possible point me in the right direction here please.
To make it clear what im trying to achieve... I am wanting to build a cascading dropdownlist user control using c# and was wondering how the best way would be to target the specific nodes in my content tree in umbraco.
For example if i had the following structure in my content section
Merseyside (type = county)
Liverpool (type = city/town)
Area of Liverpool 1 (type = suburb)
Area of Liverpool 2 (type = suburb)
Area of Liverpool 3 (type = suburb)
Birkenhead (type = city/town)
Area of Birkenhead 1 (type = suburb)
Area of Birkenhead 2 (type = suburb)
etc......
from the front end i am wanting to populate the first drop-down list with the city/towns (e.g Liverpool, Birkenhead) and based on the value that is selected by the user i want to automatically populate the second dropdownlist with the related child suburbs.
How can I make the link between my user control and the umbraco content tree so I can target these nodes?
Any help or advice would be greatly appreciated as I have tried using XSLT but unfortunately failed (http://our.umbraco.org/forum/developers/xslt/52622-Dependent-dropdown-list)
Thanks all please could someone help? the code above demonstrates some of the code i have been messing with to get this to work.
Binding specific content nodes to a dropdown
Hello All,
Using a c#' user control the following code Lists all child nodes of the current node and populates the dropdownlist with the values but how can I target a specific node of a specific doctype and display those values? It needs to be bullet proof so that it works from anywhere on the website as the search form is in the master template.
Thanks really stuck
Paul
This code will list all the numeric value of the nodes i want but not the string values. It also tells me a lot of the code is obsolete.
Thanks
Paul
Hi everyone im really struggling to get this to work and its the final thing holding me back.Im Looking if someone could possible point me in the right direction here please.
To make it clear what im trying to achieve... I am wanting to build a cascading dropdownlist user control using c# and was wondering how the best way would be to target the specific nodes in my content tree in umbraco.
For example if i had the following structure in my content section
from the front end i am wanting to populate the first drop-down list with the city/towns (e.g Liverpool, Birkenhead) and based on the value that is selected by the user i want to automatically populate the second dropdownlist with the related child suburbs.
How can I make the link between my user control and the umbraco content tree so I can target these nodes?
Any help or advice would be greatly appreciated as I have tried using XSLT but unfortunately failed (http://our.umbraco.org/forum/developers/xslt/52622-Dependent-dropdown-list)
Thanks all please could someone help? the code above demonstrates some of the code i have been messing with to get this to work.
Thanks for reading
Paul
is working on a reply...