[英]My formulary is not working … asp.net mvc 4 razor syntax
I already tried a lot of changes and nothing worked.... I am having compiler errors... 我已经尝试了很多更改,但没有任何效果。...我遇到了编译器错误...
The object of the formularys is that the user will give the place a rating using radio button and will write a text review inside TextArea.... 配方的目的是,用户将使用单选按钮给该地点评级,并在TextArea中编写文本评论。
@using (Html.BeginForm()) {
Rating:
for(int i=1;i<6;i++){
<text>@i</text>
Html.RadioButton("Rating",i)
}
<h2>Write a Review for @Model.Name</h2>
Html.TextArea("Review")
<input type="submit" value="Send Review" />
}
The issue has to do with how you're trying to print html inside the @using
block. 这个问题与您如何尝试在
@using
块内打印html有关。 Try this: 尝试这个:
@using (Html.BeginForm()) {
@:Rating:
for(int i=1;i<6;i++) {
<text>@i</text>
@Html.RadioButton("Rating",i)
}
<h2>Write a Review for @Model.Name</h2>
@Html.TextArea("Review")
<input type="submit" value="Send Review" />
}
Or better yet, replace @:Rating:
with 或者更好的是,将
@:Rating:
替换为
@Html.Label("Rating", "Rating:")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.