Copied to clipboard

Flag this post as spam?

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


  • anjaly 3 posts 23 karma points
    Nov 07, 2013 @ 06:38
    anjaly
    0

    Bind values to Dropdown List(from partial views) Mvc

           **My Development Enviorment**
    
          Using Umbraco : Version 6.1.5
    
                 MVC with Razor
    
          **Steps Followed**
    
            **step 1**
    
    
      i went to developer section and there in Package section install uComponent 
      package then create a datatype 'Text string array' property editor set to
      Ucomponent textstring Array
    
    
    
    
        [1]: /media/upload/871604c0-1bfe-4bb0-88f1-ba468073d603/rs/Untitled.png
    
        **step 2**
         I then went into Document Types and then added a new Document Type named
    
        "clean1" and then went on to create a property named "numberOfBedrooms"
         with type set as "TextstringArray"
    
    
    
    
    
    
    
    
     [1]: /media/upload/f4ae6b0b-e336-46f8-8c1c-f7a97dfc400e/rs/documenttype.png
    
       **step3**
    
    I then went into Content and then added had some values into the fields that
    I have created.
    
    
    
       [1]: /media/upload/8bf5e18d-14f7-4f2f-9d30-51d3b62a68f9/rs/contents.png
    
     **step4**
    
    Then i created a partial view named ContactUs to bind the values from the
    contents to a drop down list for that i take the parent id below is ma
    particlar section code..
    
    
    
    <div class="select">
    
             <select id="Bathrooms" >
    
        @{
    
            var newnode = Umbraco.Content(1310);  
    
        foreach(var item in newnode.Children().Where("Visible"))
        {
    
            var count = 0;
            foreach (var counter in item.numberOfBedrooms)
            {
             count = count + 1;
            }
    
    
            for (int i = 0; i < count; i++){
                foreach (var qLoop in item.numberOfBedrooms[i]){
                    <option>@qLoop.InnerText</option>
    
                }
            }
        }
                            }
    
    
                            </select>
                        </div>
    
          **step5**
     But while running i hv geting the following error  
    
    
    
     [1]: /media/upload/c37758f6-c21f-4992-87d7-f7e911672783/rs/Untitled1.png
    
      at the header i added 
           @model MvcApplication2.Models.ContactUs
    @using umbraco.MacroEngines;
              @using umbraco.NodeFactory;
        i look forward to your valueble comments..
    
  • Jeavon Leopold 3072 posts 13628 karma points MVP 10x admin c-trib
    Nov 07, 2013 @ 14:02
    Jeavon Leopold
    0
Please Sign in or register to post replies

Write your reply to:

Draft