How to list out dropdown prevalues through partial view ?
Hi,
I am using umbraco version 7 and have created a dropdown list data type called 'marketplace'. I have populated this dropdown list with a number of prevalues from 'Developer' section .I want to list out those in unordered list through partial view. How can I achieve this ?
Under 'Developer' section, i created a datatype called 'Category' with 'Dropdown list ' as Property editor and 'Category1,Category2' as prevalues.
Under 'Settings' section , I created a document type called 'MarketPlace'. Then create document type under 'MarketPlace'.... Now I need to list out those prevalues ....
If you need to be able to choose more that one, then you need to use the multiple dropdown list. If you are using this data type then you can get data from it like this.
@{ if (CurrentPage.HasValue("propertyAlias")) { <ul> @foreach (var item in CurrentPage.propertyAlias.Split(',')) { <li>@item</li> } </ul> } }
Remember to change this propertyAlias so it match your property alias for the field.
Hope this helps, don't hesitate to ask if you have further question.
I need to implement 'search' functionality in my marketplace page. Through this, I need to list out the items by searching them. Is it possible to do that in Umbraco 7 ?
How to list out dropdown prevalues through partial view ?
Hi,
I am using umbraco version 7 and have created a dropdown list data type called 'marketplace'. I have populated this dropdown list with a number of prevalues from 'Developer' section .I want to list out those in unordered list through partial view. How can I achieve this ?
Hi Thomas,
Try to see this documentation about how to get data from a dropdown list in Umbraco 7. https://our.umbraco.org/documentation/using-umbraco/backoffice-overview/property-editors/Built-in-Property-Editors-v7/DropDown-List and https://our.umbraco.org/documentation/using-umbraco/backoffice-overview/property-editors/built-in-property-editors-v7/DropDown-List-Publishing-Keys
General can you find the documentation about how to get data from the bult in property editors. https://our.umbraco.org/documentation/using-umbraco/backoffice-overview/property-editors/Built-in-Property-Editors-v7/
Hope this helps,
/Dennis
Hi Dennis,
I refered that link. but I can't get anything.. Actually my need is, how to bind all those values.
Okay,
What data type did you use for the dropdown list, there are some different, as you can see here: https://our.umbraco.org/documentation/using-umbraco/backoffice-overview/property-editors/Built-in-Property-Editors-v7/
Try to go to the document type, for the specific page, and see which data type, the field is using.
Looking forward to hear from you. Don't hesitate to ask if you have further question.
/Dennis
Hi Dennis,
Under 'Developer' section, i created a datatype called 'Category' with 'Dropdown list ' as Property editor and 'Category1,Category2' as prevalues.
Under 'Settings' section , I created a document type called 'MarketPlace'. Then create document type under 'MarketPlace'.... Now I need to list out those prevalues ....
Hi Thomas,
If you need to be able to choose more that one, then you need to use the multiple dropdown list. If you are using this data type then you can get data from it like this.
Remember to change this propertyAlias so it match your property alias for the field.
Hope this helps, don't hesitate to ask if you have further question.
/Dennis
Hi Thomas,
If you are using the dropdown list, then you can get the data like this:
Hope this helps,
/Dennis
Hi Dennis,
I got the result as what i expected through the following code which is palced under template section...
<ul class="market-ul">
@try
{
XPathNodeIterator iterator = umbraco.library.GetPreValues(1347);
iterator.MoveNext();
XPathNodeIterator preValues = iterator.Current.SelectChildren("preValue", "");
IPublishedContent blogRoot1 = Model.Content.AncestorOrSelf("Marketplace");
var url= Umbraco.NiceUrl(blogRoot1.Id);
var count = 0;
while (preValues.MoveNext())
{
string preValue = preValues.Current.Value;
if((count % 2)==0)
{
<li class="market-li even"><a href="@url?category=@preValue">@preValue</a></li>
}
else
{
<li class="market-li odd"><a href="@url?category=@preValue">@preValue</a></li>
}
count++;
}
}
catch (Exception e)
{ @e.ToString() }
</ul>
Result:
Category1
Category2
Hi Dennis,
I list out the categories as mentioned before...Now I need to list out items when I click on specific category..How can I do that ?
Hi Dennis,
I need to implement 'search' functionality in my marketplace page. Through this, I need to list out the items by searching them. Is it possible to do that in Umbraco 7 ?
is working on a reply...