I have a problem with RenderPage along with Html.BeginForm (I don't know what I'm doing wrong).
Suppose you have a simple _Test.cshtml, for example:
@{
<span>Test Text</span>
}
Then suppose you have a simple page like this one (which uses _Test.cshtml):
@{
Layout = null;
var b = new int[] { 0, 1, 2, 3, 4 };
}
@{
<html>
<body>
@* @RenderPage("~/Views/Shared/_Test.cshtml") *@
<div>
@foreach (int i in b)
{
<div>
@using (Html.BeginForm("Action", "Controller", new { id = i }, FormMethod.Post, new { id = "frm_"+ i.ToString() }))
{
<span>Label </span>
<input type="submit" id="@i.ToString()" value="@i.ToString()" />
}
</div>
}
</div>
</body>
</html>
}
If you comment out the call to the RenderPage helper, you will correctly receive a series of forms with the corresponding submit button. If you uncomment the RenderPage helper, no tag will be created. Not sure what's going on, can someone help me?
source
share