开发者

inputs don't get focus after an AJAX update. IE7

I have a page that has several forms. The user can modify the content and all requests are done via AJAX. Each AJAX call updates a section of the page, that contains a form.

After the update, all input forms don't get focus. This happens only in IE, I've tried it in Chrome and it works just fine.

Any ideas??

EDIT:

Controller

[HttpPost, ValidateInput(false)]
        public ActionResult SaveRiskAndRewardItem(int RiskAndRewardItemId, short RiskAndRewardRating, string Description)
        {
            RiskAndRewardItem model = RiskAndRewardItemModelBuilder.GetInstance().BuildOne(RiskAndRewardItemId);

            model.RiskAndRewardRating = RiskAndRewardRating;
            model.Description = Description;
            if (ModelState.IsValid)
            {
                _riskAndRewardItemRepository.Update开发者_开发知识库(model);
            }
            return PartialView("_RiskAndRewardItem", model);
        }

View

@model KII.Models.RiskAndRewardItem
<div data-risk-and-reward-item-id="@Model.Id">
    <span class="editContentLink actionLink" data-risk-and-reward-item-id="@Model.Id" data-viewer="viewrisk-and-reward-item-@Model.Id" data-editor="editrisk-and-reward-item-@Model.Id">Edit</span>
    <div id="viewrisk-and-reward-item-@Model.Id">
        <table class="riskAndRewardTable">
            <tr data-risk-and-reward-item-id="@Model.Id">
                @for (int i = 1; i < 8; i++)
                {
                    <td class="risk-and-reward-item @((i == @Model.RiskAndRewardRating) ? "risk-and-reward-item-selected" : "")">@i
                    </td>
                }
            </tr>
        </table>
        <div style="display: inline">
            <div style="float: left">
                lower rewards/risk
            </div>
            <div style="float: right">
                higher rewards/risk
            </div>
            <br />
            <br />
        </div>
        <div data-risk-and-reward-item-id="@Model.Id">
            @Html.Raw(@Model.Description)
        </div>
    </div>
    <div id="editrisk-and-reward-item-@Model.Id" style="display: none;width:100%">
        @using (Ajax.BeginForm("SaveRiskAndRewardItem", null, new AjaxOptions
        {
            UpdateTargetId = "itemContent-" + @Model.Item.Id,
            HttpMethod = "POST",
            InsertionMode = InsertionMode.Replace,
            OnBegin = "loading(\"itemContent-" + @Model.Item.Id+"\")",
            OnSuccess = "loaded(\"itemContent-" + @Model.Item.Id+"\")",
        }, new { @id = "TitleForm" }))
        {

            <table class="riskAndRewardTable">
                <tr data-risk-and-reward-item-id="@Model.Id">
                    @for (int i = 1; i < 8; i++)
                    {
                        <td class="risk-and-reward-item-edit @((i == @Model.RiskAndRewardRating) ? "risk-and-reward-item-selected-edit" : "")">@i
                        </td>
                    }
                </tr>
            </table>

            <br />

            <input id="RiskAndRewardItemId" name="RiskAndRewardItemId" type="hidden" value="@Model.Id" />
            <input id="RiskAndRewardRating" name="RiskAndRewardRating" type="hidden" value="@Model.RiskAndRewardRating" />
            <textarea id="Description" class="htmleditor" name="Description" rows="5" cols="40">@Model.Description</textarea>
            <div style="text-align: right">
                <input id="titleButton" type="submit" class="button" value="Save" /></div>
        }
    </div>
</div>

I have like 4 different partial views which each has its method in the controller. Like the one above.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜