Reputation: 347
I am getting compilation error in the code below, it complaining about a bracket but all the bracket and matching up I am a bit lost can someone please help me here thank in advance.
Error:
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1513: } expected
@using System.Linq
@using System
@using System.Text
@using System.Collections;
@model List<PairingTest.Web.Models.QuestionnaireViewModel>
<html>
<head>
<title></title>
</head>
<body>
@using (Html.BeginForm("GetMarks","Questionnaire")) {
for(int i = 0;i < Model.Count;i++) {
<text> @Model[i].QuestionAsk </text> <br />
var s = @Model[i].PossibleAnswer;
string[] exAns = s.Split(',');
foreach( var singleAns in exAns){
<text>singleAns</text> <br />
@Html.RadioButtonFor(M =>M[i].UserAnsResponse, singleAns); <br />
}
<br />
}
<input type="submit" name="submit" />
}
</body>
Upvotes: 0
Views: 544
Reputation: 1145
Your error is in the assignment of the s
variable, please see fixed code below. You also have unnecessary <text>
tags and extra semicolons. I suggest you read up a little bit on Razor syntax.
@using System.Linq
@using System
@using System.Text
@using System.Collections;
@model List<PairingTest.Web.Models.QuestionnaireViewModel>
<html>
<head>
<title></title>
</head>
<body>
@using (Html.BeginForm("GetMarks","Questionnaire")) {
for(int i = 0;i < Model.Count;i++) {
@Model[i].QuestionAsk <br />
var s = Model[i].PossibleAnswer;
string[] exAns = s.Split(',');
foreach( var singleAns in exAns){
@singleAns <br />
@Html.RadioButtonFor(M =>M[i].UserAnsResponse, singleAns) <br />
}
<br />
}
<input type="submit" name="submit" />
}
</body>
Upvotes: 2