选项
Public Class VariationOptions
Public Property OptionID As Integer
Public Property Name As String
Public Property Price As Double
End Class
变异类
Public Class Variation
Public Property VariationID As Integer
Public Property UrunID As Integer
Public Property Name As String
Public Property inputType As String
Public Property Options As IList(Of VariationOptions)
End Class
我是数据库中产品的精选变体。
我希望列表中的这些变体带有复选框和单选按钮。
如何列出此输入以及如何请求所选值?
示例图片
查看
@ModelType OnlineSiparis.Product
<script type="text/javascript">
function isNumberKey(evt)
{
var charCode = (evt.which) ? evt.which : event.keyCode;
if (charCode != 46 && charCode > 31
&& (charCode < 48 || charCode > 57))
return false;
return true;
}
</script>
@Using (Html.BeginForm("AddProductToCart", "restaurants",Nothing,FormMethod.Post))
@<div class="row1-1 bgBordo">
@Html.DisplayTextFor(Function(m) m.Name)
@Html.HiddenFor(Function(m) m.Price)
@Html.HiddenFor(Function(m) m.Name)
<div class="right" style="cursor:pointer;"><img src="~/Content/images/Icons/close20.png" onclick="HideVariation();" /></div>
<div class="clear"></div>
</div>
@<div class="box">
<div class="smallbox">
<div class="smallcolumn1-4 left">
Quantity
</div>
<div class="smallcolumn2-4 left">
@Html.TextBoxFor(Function(m) m.Qty, New With{.onkeypress="return isNumberKey(event)"})
</div>
<div class="clear"></div>
</div>
@For j As Integer = 0 To Model.Variations.Count-1
@<div class="smallbox">
<div class="smallcolumn1-4 left">
@Html.DisplayFor(Function(m) m.Variations(j).Name)
</div>
<div class="smallcolumn2-4 left">
@For i As Integer=0 to Model.Variations(j).Options.Count-1
@<div class="variationName left">
@If Model.Variations(j).inputType = "radio" Then
@Html.RadioButtonFor(Function(m) m.AddSelectedVariation, Model.Variations(j).Options(i).OptionID)
End If
@Html.DisplayFor(Function(m) m.Variations(j).Options(i).Name)
</div>
@<div class="variationPrice left">
@string.Format("{0:C}", Model.Variations(j).Options(i).Price )
</div>
@<div class="clear"></div>
@<br />
Next
</div>
<div class="clear"></div>
</div>
Next
<div class=" textcenter"><input type="submit" class="btnYesil" value="Ekle" /></div>
</div>
End Using