我在asp.net mvc web应用程序中有以下视图: -
<td id = "@item.RESOURCEID">
@using (Ajax.BeginForm("CreateOnTMS","VirtualMachine", new AjaxOptions {
InsertionMode = InsertionMode.Replace,
UpdateTargetId = item.RESOURCEID.ToString() ,
LoadingElementId = item.RESOURCEID.ToString(),
HttpMethod = "POST"})){
@Html.AntiForgeryToken()
<span class="f"> @Html.DisplayNameFor(model=>model.VirtualMachine.RoleID)</span>
<span class="f">@Html.DisplayNameFor(model=>model.VirtualMachine.ServerID)</span>
@Html.Hidden("ResourceID", item.RESOURCEID)
<input type="submit" value="Add To TMS" class="btn btn-primary"/>
<img src="~/Content/Ajax-loader-bar.gif" class="loadingimage" id = item.RESOURCEID.ToString()/>
}
</td>
但我需要动态创建一个加载图像并为其分配resourceID,但这样做不起作用,并且在单击Ajax.BeginForm时加载imag不会加载。任何想法可能是什么问题?
答案 0 :(得分:1)
您没有写出正确的ID。试试这个:
<img src="~/Content/Ajax-loader-bar.gif" class="loadingimage" id="@(item.RESOURCEID.ToString())" />