I have a view which contains a partial view. I need to pass a value from the parent view into the partial view. I do this like so:

   @Html.Partial("_DrugScan", new TIMS.Models._DrugScan() { ASNID = Model.ASNID })

The "_DrugScan" class contains only two properties, the ASNID and a UPC. The partial view uses a form to fill in the UPC like so:

@model TIMS.Models._DrugScan


    @using (Html.BeginForm("DrugScan", "Receive", FormMethod.Post, new { @class = "form-horizontal", role = "form"}))

        <dl class="dl-horizontal">
                @Html.Label("Scan Drug UPC")
                @Html.Kendo().MaskedTextBoxFor(x => x.UPC).Mask("000000000000").PromptChar("-").HtmlAttributes(new {@id="UPC_textbox"})



The problem I have is that when I submit the form, the UPC property is filled out but the ASNID is back to null/default. I can hit a breakpoint in the page and see that the ASNID is getting set appropriately but is lost on submission. What am I doing wrong?

Related posts

Recent Viewed