Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Thomas T 66 posts 227 karma points
    Mar 02, 2015 @ 14:18
    Thomas T
    1

    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 ?

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Mar 02, 2015 @ 14:22
  • Thomas T 66 posts 227 karma points
    Mar 02, 2015 @ 14:52
    Thomas T
    0

    Hi Dennis,

              I refered that link. but I can't get anything.. Actually my need is, how to bind all those values.

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Mar 02, 2015 @ 15:00
    Dennis Aaen
    0

    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

  • Thomas T 66 posts 227 karma points
    Mar 02, 2015 @ 15:08
    Thomas T
    0

    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 ....

     

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Mar 02, 2015 @ 15:18
    Dennis Aaen
    0

    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.

    @{
        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.

    /Dennis

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Mar 02, 2015 @ 15:22
    Dennis Aaen
    0

    Hi Thomas,

    If you are using the dropdown list, then you can get the data like this:

    @if (CurrentPage.HasValue("propertyAlias")) {
    <p>@CurrentPage.propertyAlias</p>
    }

    Hope this helps,

    /Dennis

  • Thomas T 66 posts 227 karma points
    Mar 02, 2015 @ 15:31
    Thomas T
    100

    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

     

     

  • Thomas T 66 posts 227 karma points
    Mar 03, 2015 @ 08:30
    Thomas T
    0

    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 ?

  • Thomas T 66 posts 227 karma points
    Mar 03, 2015 @ 11:40
    Thomas T
    0

    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 ?

Please Sign in or register to post replies

Write your reply to:

Draft