如何从视图向控制器发送html img 属性值?
<div class="fileupload-new thumbnail" style="width: 200px; height: 150px;">
@if (Model == null)
{
<img src="http://www.placehold.it/200x150/EFEFEF/AAAAAA&text=no+image" />
}
else
{
if (!String.IsNullOrEmpty(Model.Sender.Logofile))
{
<img src="~/Content/img/Company/LogoFiles/@Model.Sender.Logofile" id="logoimg"/>
}
}
</div>
<div class="fileupload-preview fileupload-exists thumbnail" style="max-width: 200px; max-height: 150px; line-height: 20px;"></div>
<div>
<span class="btn btn-file"><span class="fileupload-new">Select image</span><span class="fileupload-exists">Change</span>
<input type="file" id="LogoFileUp" name="LogoFileUp" size="19" style="opacity: 0;" data-form="uniform" required="required" /></span>
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Remove</a>
</div>
我想检查是否有值img logoimg ?我怎样才能做到这一点? 提前谢谢。
答案 0 :(得分:2)
添加一个隐藏的输入,其值为img的src。
答案 1 :(得分:2)
添加一个输入(隐藏),其值与img的src相同