我想在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 –