Chrome中没有RedirectToAction

时间:2013-03-17 12:37:07

标签: asp.net-mvc google-chrome asp.net-mvc-4

返回RedirectToAction(“List_News”,“Admins”);没有使用chrome。所有浏览器一切都很好!他们清晰的形式,但铬重新发送数据!求助于我,也许有人知道这个问题的解决方案!

查看

<div class="list_news" >
    <script type="text/javascript">
        $(document).ready(function () {
            $("input").keypress(function (e) {
                if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
                    return false;
                }
            });
        });
</script>
    <ul>

        @foreach (var News in Model.Anew)
        {

            if (News.hide != 0)
            {

                <li>
                    @using (Html.BeginForm())
                    { 

                        <span style="float: left" class="span_edit">Позиція:</span> 
                        @Html.TextBoxFor(m => m.Required.Thisposition, new { Value = News.position, @class = "edit_position", maxlength = "4" })
                        <span style="float: left; margin-left: 10px;" class="span_edit">Видалити:</span>
                        @Html.CheckBoxFor(x => x.Required.hide, new { @class = "span_edit", style = "float: left; margin-left:10px; margin-top:8px;" })
                        @Html.HiddenFor(m => m.Required.list_id_news, new { Value = News.Id })
                        @Html.HiddenFor(m => m.Required.OldPosition, new { Value = News.position })
                        <input type="submit" value="Зберегти" style="float: left; margin: 0; margin-left: 10px;" class="save"/>
                    }
                    @Html.ActionLink(News.name_news, "News", new { news_id = News.Id })
                    <span style=" margin-left: 38px; font-weight: normal; display: inline-block; width: auto; height: auto; color: red"  class="span_edit">@TempData[News.Id.ToString()] </span>
                </li>
            }
        }                                                                 
    </ul> 
</div>

控制器

public ActionResult List_News()
        {
            ListNews tr = new ListNews();

                tr.Anew = ot.GetNewsAll();
            tr.Categorynew = ot.Allcategory();
            return View(tr);
        }




[HttpPost]
    public ActionResult List_News(ListNews model)
    {
        if (Convert.ToInt64(model.Required.Thisposition) >= ot.NewsMin() && Convert.ToInt64(model.Required.Thisposition) <= ot.NewsMax())
        {
            if (model.Required.hide)
            {
                ot.UpdateNews(model.Required.list_id_news, 0);
                ot.ReestablishPosition(model.Required.list_id_news, model.Required.OldPosition);
            }
            if (!model.Required.hide && model.Required.OldPosition != Convert.ToInt64(model.Required.Thisposition) &&
                model.Required.OldPosition < Convert.ToInt64(model.Required.Thisposition))
            {
                ot.ChangePositionDown(model.Required.list_id_news, Convert.ToInt64(model.Required.Thisposition),
                                      model.Required.OldPosition);
            }
            if (!model.Required.hide && model.Required.OldPosition != Convert.ToInt64(model.Required.Thisposition) &&
                model.Required.OldPosition > Convert.ToInt64(model.Required.Thisposition))
            {
                ot.ChangePositionUp(model.Required.list_id_news, Convert.ToInt64(model.Required.Thisposition),
                                    model.Required.OldPosition);
            }
        }
        else
        {
            TempData[model.Required.list_id_news.ToString()] = "Позиція повина бути в проміжку від " +
                                                               ot.NewsMin().ToString() + " до " +
                                                               ot.NewsMax().ToString()+"!";
        }
        ModelState.Clear();
        return RedirectToAction("List_News","Admins");
    }

0 个答案:

没有答案