我想在ASP.NET使用ViewBag内引号,像这样:ASP.NET使用ViewBag引号内
@using (Html.BeginForm("Index?community=" + @ViewBag.community + "&lot=" + @ViewBag.lot + "",
"UploadFile",
FormMethod.Post,
new { enctype = "multipart/form-data" }))
{
<label for="file">Upload File:</label>
<input type="file" name="file" id="file" /><br><br>
<input type="submit" value="Upload File" />
<br><br>
@ViewBag.Message
}
我也曾尝试以下操作:
@using (Html.BeginForm("[email protected]&[email protected]",
"UploadFile",
FormMethod.Post,
new { enctype = "multipart/form-data" }))
{
<label for="file">Upload File:</label>
<input type="file" name="file" id="file" /><br><br>
<input type="submit" value="Upload File" />
<br><br>
@ViewBag.Message
}
是否有可能在引号内使用@ViewBag?
另外,你可能会发现你的生活对强类型模型更有意义。建议使用自定义视图模型而不是凌乱的ViewBag。 https://stackoverflow.com/questions/13779294/viewmodels-or-viewbag –