Html 图像在网格中未正确显示

Html 图像在网格中未正确显示,html,model-view-controller,grid,Html,Model View Controller,Grid,我正在尝试在我添加if-else部分的网格中显示图像。在这个网格中,else部分工作正常,但在If部分中,我使用的静态图像未显示。你能告诉我哪里出了错吗 @Html.Grid(Model).Named("ServiceCompendiumData").Columns(x => { x.Add(y => y.Physician_ImageFileName).Titled("Photo").Encoded(false).S

我正在尝试在我添加if-else部分的网格中显示图像。在这个网格中,else部分工作正常,但在If部分中,我使用的静态图像未显示。你能告诉我哪里出了错吗

 @Html.Grid(Model).Named("ServiceCompendiumData").Columns(x =>
   {
         x.Add(y => y.Physician_ImageFileName).Titled("Photo").Encoded(false).Sanitized(false).Filterable(false).RenderValueAs(y => @<div style="width:100px;">
                @if (y.Physician_ImageBase64String == null)
                         {
                           <img src='~/Images/_defaultMan.png' alt="Image" style="height:100px; width:100px;"/>
                         }
                         else
                         {<img alt="Image" style="height:100px; width:100px;" src='@y.Physician_ImageBase64String' ) />}
            </div>).SetWidth(150);
       x.Add().Encoded(false)
                   .Sanitized(false)
                   .SetWidth(20)
                   .RenderValueAs(y => Html.ActionLink(" Edit", "PhysicianBiodata", new { Id = y.ID }, new { @class = "btn btn-primary fa fa-chevron-circle-down" }));

       x.Add().Encoded(false)
           .Sanitized(false)
           .SetWidth(20)
           .RenderValueAs(y => Html.ActionLink(" Delete", "Delete", new { ClinicIdToDelete = y.ID }, new { @class = "btn btn-primary fa fa-chevron-circle-down", @onclick = "return DeleteConfirm(" + y.ID + ");" }));

   }).Sortable(true).WithPaging(10).WithMultipleFilters();
@Html.Grid(Model).Named(“ServiceCompendiumData”).Columns(x=>
{
x、 添加(y=>y.medicine\u ImageFileName).标题为(“照片”).编码(false).消毒(false).可过滤(false).渲染值为(y=>@
@如果(y.U ImageBase64String==null)
{
}
其他的
{}
).设置宽度(150);
x、 Add().Encoded(false)
.消毒(假)
.SetWidth(20)
.RenderValueAs(y=>Html.ActionLink(“编辑”,“PhysicianBiodata”,新的{Id=y.Id},新的{@class=“btn-btn-primary-fa-fa-chevron-down”});
x、 Add().Encoded(false)
.消毒(假)
.SetWidth(20)
.RenderValueAs(y=>Html.ActionLink(“删除”,“删除”,新建{ClinicIdToDelete=y.ID},新建{@class=“btn btn primary fa fa chevron circle down”,@onclick=“return DeleteConfirm”(+y.ID+”;“}));
}).Sortable(true).带分页(10).带多个筛选器();

更改了If(string.IsNullOrEmpty(y.medicine\u ImageBase64String))的条件。然后成功了