Razor populate Drop down list with document type filter property
Hi,,
I have created a document type resturant which has a filter property called type which lists all the resturants but, i need to filter the resturants by type a property set with in the content within the docType property type, i need to firstly populate the DDL with all the types excluding any duplication and then filter the nodes according to the filter
Please coulsd you give me any pointers as to how to do the first part , as am sure the latter will
be just passing the value into the razor foreach listing code i have see below.
I had to do this last week so I used a control which (using nodefactory) which creating a DDL displaying all the current services availbale on the clients site for a feedback form. You can see this here on my test server.
This lists, pages and truncates my content but i have created to other propertie within the document type called location and type which i want to use to refine the results, the question i have it how do i add pass the refined properties from a DDL which ill need to populate based on the doc type to the script and refine using the where.
Also do i need a usercontrol for the DDL? of do i need to create a data type populated manuallyand render it in the template then on click pass results to the script.
Razor populate Drop down list with document type filter property
Hi,,
I have created a document type resturant which has a filter property called type which lists all the resturants but, i need to filter the resturants by type a property set with in the content within the docType property type, i need to firstly populate the DDL with all the types excluding any duplication and then filter the nodes according to the filter
Please coulsd you give me any pointers as to how to do the first part , as am sure the latter will
be just passing the value into the razor foreach listing code i have see below.
regards
Neil.
Hey Neil,
I had to do this last week so I used a control which (using nodefactory) which creating a DDL displaying all the current services availbale on the clients site for a feedback form. You can see this here on my test server.
http://development.glasgowplastering.co.uk/get-quote.aspx
I used a control because I was developing the feedback form anyway...there may well be an easier way to do this without the need for a control.
Regards,
Stephen
It should be as simple as adding a Where clause to your foreach, for example:
@{ var type = Request["type"]; }@foreach (var resturant in itemGroup.Where("type == " type) {
// do your thing
}
I know this is probably a simplw answer but how do i populate the ddl with the dta type i have created which is control render of Dropdown list.
Do you have some example code? I don't know what you're trying to ask here.. sorry.
I'm pretty sure this is what your trying to do...http://our.umbraco.org/wiki/reference/code-snippets/databind-node-children? except on a drop down list.
@Stephen can't mix user controls and Razor scripts though. What are you using Neil? I was assuming Razor as this IS the Razor forum..
he is my code
This lists, pages and truncates my content but i have created to other propertie within the document type called location and type which i want to use to refine the results, the question i have it how do i add pass the refined properties from a DDL which ill need to populate based on the doc type to the script and refine using the where.
Also do i need a usercontrol for the DDL? of do i need to create a data type populated manuallyand render it in the template then on click pass results to the script.
Roll on christmas...
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.