小编Kat*_*e R的帖子

JQuery UI弹跳效果 - 在进入div时仅反弹一次

当鼠标进入/悬停在div上时,我有一个div想要反弹一次.

我在Chrome中使用的代码,但在Firefox或IE中没有.

http://jsfiddle.net/d7UjD/73/

在Chrome中,它会根据需要弹跳一次,但在FF和IE中,只要鼠标保持原位,弹跳就会继续.

我也试过$('#box').one("mouseenter", function() {但是盒子反弹一次,后来进入div的条目不会触发效果.

关于为什么浏览器表现不同以及我能做些什么的任何想法?

jquery jquery-ui bounce

5
推荐指数
1
解决办法
7843
查看次数

使用DBContext Entry.OriginalValues和Entry.NewValues记录更改的值

我有一个文档库站点,想要在编辑文档对象时发送电子邮件,其中包含更改的摘要.

数据库交互是使用DBContext的Code First Entities Framework

这是我到目前为止:

    [HttpPost]
    public ActionResult Edit(Document document, bool sendEmail, string commentsTextBox)
    {

        if (ModelState.IsValid)
        {
            docsDB.Entry(document).State = EntityState.Modified;

            foreach (string propertyName in docsDB.Entry(document).OriginalValues.PropertyNames)
            {
                var OriginalValue = docsDB.Entry(document).OriginalValues.GetValue<object>(propertyName);
                var NewValue = docsDB.Entry(document).CurrentValues.GetValue<object>(propertyName);
                if (!OriginalValue.Equals(NewValue))
                {
                    //capture the changes
                }
            }

            docsDB.SaveChanges();
            if (sendEmail)
            {
               //sends email
            }
            return RedirectToAction("Index");

        }
Run Code Online (Sandbox Code Playgroud)

但是,OriginalValue和NewValue始终相同 - 更新的值.

有什么方法,缺少像写入文件那样的hacky,在POST之前捕获文档的状态?

asp.net-mvc entity-framework edit dbcontext

2
推荐指数
1
解决办法
2805
查看次数