我想在成功更新后显示一个弹出框。我做的是
在 Controller 中
var objContext = new KnittingdbContext();
objContext.ProductTypes.Attach(producttype);
var obJBlog = objContext.Entry(producttype);
obJBlog.Property(a => a.ProductTypeCode).IsModified = true;
obJBlog.Property(a => a.ProductTypeName).IsModified = true;
objContext.SaveChanges();
TempData["SuccessEdit"] = "a";
return RedirectToAction("vwProductTypeIndex");
在 vwProductTypeIndex View 中
@if (TempData["SuccessEdit"] != null)
{
<div class="green">
<p style="color:green;">Updated Successfully</p>
</div>
}
但问题是这只显示文本。
我有一个使用 css 创建的消息框
<!--popup model-->
<div class="modal fade" id="basic" role="dialog" aria-labelledby="basic" aria-hidden="true">
<div class="modal-dialog modal-sm">
<div class="modal-content" style="background-color:#ffffff; borderolid 4px #44d775;margin-top:253px; left:-25px;">
<div class="modal-header" style="background-color:#44d775; height:15px;">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="margin-top:-12px;">x</button>
<span class="glyphicon glyphicon-ok" style=" color:yellow; font-size:large; top:-10px; left:115px;" aria-hidden="true"></span>
<h4 class="modal-title" id="myModalLabel" style="text-align:center;"></h4>
</div>
<p style="text-align:center; font-family:'Ebrima'; color:black; margin-top:15px;"> <strong> saved Successfully </strong></p>
</div>
</div>
</div><!--/end popup model--
我希望出现此弹出框而不是该文本。我怎样才能做到这一点?提前致谢!
最佳答案
尝试你的 div 标签并传递 id
<div class="green" data-toggle="modal" data-target="#basic">
<p style="color:green;">Updated Successfully</p>
</div>
关于javascript - 更新成功后显示弹出窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32139453/