This is a migrated thread and some comments may be shown as answers.

Kendo Window Content not binding Model Values

1 Answer 194 Views
Window
This is a migrated thread and some comments may be shown as answers.
MASOOD
Top achievements
Rank 1
MASOOD asked on 14 Dec 2020, 01:33 PM

Hi ,

I am using a Html form inside the Kendo window .But the model values are not binding to the textbox and dropdown controls when I am submitting the form.

Here is my code.

Html.Kendo().Window()
.Name("addressPopup")
.Visible(false).Title(false)
.Scrollable(false)
.Draggable(false)
.Modal(true)
.Content(@<text>
<div id="AddressVerificationModal" style="padding:2% !important">
<h1 class="header-lbl-md-2" style="line-height:1px">Verify information</h1>
<div class="divider-headpopup " style="width:445px">
<span class="divider-headpopup" />
</div>
<br />
<br />
<div class="searchformfld padright" style="width:49%!important">
@Html.TextBoxFor(m => m.FirstName, new { placeholder = " ", autocomplete = "off", onBlur = "ValidateField(event)" })

</div>

<div class="searchformfld " style="width:30%;padding-top:11px">
            @Html.DropDownListFor(m => m.StateCode, new SelectList(States, "StateCode", "StateCode"), new { placeholder = " ", autocomplete = "off" })
            <label for="StateCode" id="lblStateCode">State*</label>
 </div>

 </div></text>).Render();

If I remove the Kendow Window code it is binding the values as expected.

1 Answer, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 16 Dec 2020, 10:53 AM

Hi Masood,

By default, the Window renders its content in a div element that is appended at the end of the page body. Thus, anything nested in the Window will be rendered outside of the form. To avoid that from happening you can use the Window's AppendTo option, e.g.,

.AppendTo("#myFormID")

It allows specifying the element to which the Window will be appended.

Regards,
Ivan Danchev
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Window
Asked by
MASOOD
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Share this question
or