@{ Html.BeginForm("SaveClie" /> @{ Html.BeginForm("SaveClie" /> @{ Html.BeginForm("SaveClie"/>

HTML Helper Has A Different Value Than Model

19 Views Asked by At

I'm Trying to figure something out. I have a form in a cshtml file that has some elements on it:

<div id="RemitContainer">
    @{
    Html.BeginForm("SaveClientRemit", "ClientContract", FormMethod.Post, new { Id = "saveRemitForm", targetId = "editRemitDialog" });
    }
    @Html.ModelData()

    @Html.Input(x => x.CapitationRate).SelectList(ViewData["CapitationRateList"] as SelectList)
    @Html.Input(x => x.RequiresApproval)
    @Html.Input(x => x.RemitColumn)
    @Html.Input(x => x.Operator)
    <div id="StartsWithSection">
        @Html.Input(x => x.StartsWithCode)
    </div>
    <div id="RemitCodesSection" class="row">
        @Html.Label("Remit Code(s)")
        @Html.TextAreaFor(x => x.RemitCodes, new { style = "width: 400px" })
        <p>@Model.RemitCodes</p>
    </div>
    <input type="button" value="Search" id="searchRemitBtn" />
</div>

The searchRemitBtn triggers a Javascript that calls a controller and returns the same page:

$("#searchRemitBtn").click(function () {
            ajaxPost("editRemitDialog",
                "/ClientContract/[email protected]",
                    $('#saveRemitForm').serialize(), function () { });

});

Controller:

            BuildCapitationRateViewData();
            var contract = _factory.Create<ClientRemitDataContract>();
            var response = _invoiceService.GetFilteredRemitCodes(new ServiceRequest<Guid>(clientId));
            contract.RemitCodes = "Test 123";
            return PartialView("EditClientRemit", contract);

My issue is that the value of the text area is coming back different than @Model.RemitCodes. I thought the text area should be bound to the model. No?

0

There are 0 best solutions below