即使在更改图像路径后firebug显示更改的图像,img元素也不会在视图上更改

时间:2014-12-02 09:07:50

标签: jquery asp.net-mvc asp.net-mvc-3 asp.net-mvc-4

我正在使用ajax替换' html' ' tr'我的自定义' html'表格的元素。我从表中抓取了tr元素,并用部分视图内容替换了它的html。但是tr元素内的图像不会根据局部视图而改变。

//我的javascripts

$(document).on('submit', '#frm-update-prj', function (e) {
        e.preventDefault();
        var myform = $(document).find('#frm-update-prj')[0];
        var formData = new FormData(this);
        $.ajax({
            url: "/Dashboard/SaveEditedProjectTitle",
            type: "post",
            data: formData,
            mimeType: "multipart/form-data",
            contentType: false,
            cache: false,
            processData: false,
            success: function (resultView) {
                    var grid = $(".tbl-horizontal").data("kendoGrid");
                    var selectedRow = grid.dataItem($(EditElement).parents('tr'));

                    selectedRow.set('Sortby', resultView);
                    $(EditElement).parents('tr').html(resultView);

                    $.fancybox.close();
                    toastr.success("Project Updated!");
            },
            error: function (result) { }
        });
    });

//我的局部视图加载到tr元素

   <div class="project-list">
        <div class="projects">
            @*<a href="#" class="project-link" style="background-color:@TempData["bkColor"];background-image: url(@Url.Action("GetProjectImage", "Dashboard", new { prj = @Md5Encryption.Encrypt(@Model.AssetId.ToString()) })); background-size: cover; border-radius: 5px 5px 0 0; ">
            </a>*@
            <a href="#" class="project-link" style="background-color:@TempData["bkColor"]; background-size: cover; border-radius: 5px 5px 0 0; ">
                @*<img style="height:100%;width:100%;" src="@Url.Action("GetProjectImage", "Dashboard", new { prj = @Md5Encryption.Encrypt(@Model.AssetId.ToString()) })">*@
                <img id="@Guid.NewGuid().ToString()" style="height:100%;width:100%;" src="@Model.imagePath">

            </a>
            <div class="project-content-options">
                <a href="@Url.Action("CreateEditor", "Dashboard", new { prj = @Md5Encryption.Encrypt(@Model.AssetId.ToString()) })" class="view-link">OPEN PROJECT</a>
                <div class="btn-group">
                    <a title="" data-toggle="tooltip" class="btn btn-sm btn-alt option-btn remove" href="@Url.Action("DeleteProject", "Dashboard", new { prj = @Md5Encryption.Encrypt(@Model.AssetId.ToString()) })" data-original-title="Remove"><span>Remove</span></a>
                    <a title="" data-toggle="tooltip" class="btn btn-sm btn-alt option-btn edit" href="@Url.Action("EditProjectTitle", "Dashboard", new { prj = @Md5Encryption.Encrypt(@Model.AssetId.ToString()) })" data-original-title="Edit"><span>Edit</span></a>
                    <a title="" data-toggle="tooltip" class="btn btn-sm btn-alt option-btn download" href="@Url.Action("DownloadProject", "Dashboard", new { prj = @Md5Encryption.Encrypt(@Model.AssetId.ToString()) })" data-original-title="Download"><span>Download</span></a>
                    <a title="" data-toggle="tooltip" class="btn btn-sm btn-alt option-btn share fancybox" href="#divShareProject" data-url="@Url.Action("PublishPrj", "PublishProject", new { prj = @Md5Encryption.Encrypt(@Model.AssetId.ToString()) })" data-original-title="Share"><span>Share</span></a>
                    <a title="" data-toggle="tooltip" class="btn btn-sm btn-alt option-btn preview" target="_blank" href="@Url.Action("Index", "PublishProject", new { prj = @Md5Encryption.Encrypt(@Model.AssetId.ToString()) })" data-original-title="Preview"><span>Preview</span></a>

                </div>
            </div>
        <span class="caption">@Model.AssetName</span>
        <span class="date"><span>Created on:</span> @Html.DisplayFor(x => Model.CreatedDate)</span>
        <span class="date-time"><span>Last modified:</span> @Html.DisplayFor(x => Model.ModifiedDate) @Model.ModifiedDate.ToShortTimeString()</span>
    </div>
</div>

我不明白为什么当我改变路径时图像没有改变。甚至冷杉表明改变了形象。请帮忙。

0 个答案:

没有答案