**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
**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"
**step3**
I then went into Content and then added had some values into the fields that
I have created.
**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
at the header i added
@model MvcApplication2.Models.ContactUs
@using umbraco.MacroEngines;
@using umbraco.NodeFactory;
As iam new to umbraco i look forward to your valueble comments..
This code is not be used as Scripting File macro, it should be used as a Partial View. You should not use Scripting files at all when using MVC, they are legacy.
When using MVC, you should use Partial Views mostly, if you really need a macro for use in a RTE for example, then you can use a Macro Partial View, more in of on this here
@jeavon:haii Thankx alot code worked...now a little bit confution..actually iam having...one more contents which
contain same same namespace.."number of bed rooms".
here the second one "clean2" it also have same details like number of bedrooms...but values changes..so my dobut is
how i can display "clean2" details[with in same dropdown of clean1] when i select it...
I think it is going to do that already as it is looping through all children of node 1310 which I guess is "CleanType" in your screens shot, so just adjust the markup so that each final out is an
Bind Values To DropDown From Contents
Hi Manu,
Welcome to Our!
Try something like this:
Jeavon
Ah of course, you will need uComponents v6 for this to work
This code is not be used as Scripting File macro, it should be used as a Partial View. You should not use Scripting files at all when using MVC, they are legacy.
When using MVC, you should use Partial Views mostly, if you really need a macro for use in a RTE for example, then you can use a Macro Partial View, more in of on this here
Without uComponents v6, I think something like this might work
I think it is going to do that already as it is looping through all children of node 1310 which I guess is "CleanType" in your screens shot, so just adjust the markup so that each final out is an
is working on a reply...