I am having Code like below in my view.
@if (!Model.DisableBuyButton || !Model.DisableWishlistButton)
{
<div class="qutblk">
<span>@Html.LabelFor(model => model.EnteredQuantity, new { @class = "input-small" }, " :")</span>
@if (Model.AllowedQuantities.Count > 0)
{
@Html.DropDownListFor(model => model.EnteredQuantity, Model.AllowedQuantities, new { @class = "input-small" })
}
else
{
@Html.TextBoxFor(model => model.EnteredQuantity, new { @class = "input-small" })
}
} @Html.Widget("productdetails_add_info")
</div>
Here if i have the ALLOWEDQUANTITIES.COUNT
is more then 0.I
need drop down list for quantities.
For example if the quantity is 5 i need 1,2,3,4,5
numbers in my drop down list.And if the quantity is 7 i need 1,2,3,4,5,6,7
numbers in my drop down.
But my problem is i am not able to bind the data like numbers in my drop down that means if the quantity is 5 it simply displaying only 5 number in drop down list not displaying 1,2,3,4,5
.
1,2,3,4,5
if you give it 5 as quantity. How can you expect razor to do it ? Why don't you write a custom helper to do as you expect ? – Karthik Chintala