title: MVC append partial view to existing kendo pop up window
body: <p>I created a kendo pop up window that loads a dropdown selection from the controller in the contents. I also added a change event that gets the id of the selected index and pass it to the controller and returns a partial view with textboxes that might change based on selection, so the creation of textboxes needs to be dynamic. 
  I tried adding Html.Partial(_myPartialView), but the results are not rendering. What am I doing wrong? </p>
  
  <pre><code>@(Html.Kendo().Window()
    .Name("userSetupWindow")
    .AppendTo("#useAcct")
    .Width(600)
    .Height(600)
    .Scrollable(false)
    .Modal(true)
    .Title("New Setup")
    .Actions(actions =&gt; actions.Refresh().Close())
    .Draggable()
    .Content("&lt;section id='CreateLink' class = 'saveNewDialog-screen'&gt;" +
             "&lt;div class='saveNewLinkDialog'  style='border: none;' &gt;" +
             "&lt;div style='border: none;'&gt;" +
          "&lt;table&gt;" +
                 "&lt;tr style='height: 30px;'&gt;" +
                   "&lt;td style='width: 30%; vertical-align: top;'&gt;" +
                    "&lt;div id='divAccounts' class ='createNew'&gt; " +
                    "&lt;label id='lbList' for='createNew' class='CreateNew-Label'&gt;Select New&lt;/label&gt;&amp;nbsp;" +
                     Html.Kendo().DropDownList()
                    .Name("userList")
                    .DataSource(source =&gt; source.Read(read =&gt; read.Action("GetUsers", "UserAcctMgmt")
                    .Data("getSelectedId")
                    .Type(HttpVerbs.Post)))
                    .DataTextField("UserName")
                    .DataValueField("Id")
                    .Value("Id")
                    .SelectedIndex(0)
                    .Events(events =&gt; events.DataBound("onDropDownDataBound"))
                    .Events(events =&gt; events.Change("onSelect")) +
                    "&lt;/div&gt;" +
                    "&lt;/td&gt;" +
                    "&lt;/tr&gt;" +
                    "&lt;tr style='height: 30px;'&gt;" +
                    "&lt;td&gt;&amp;nbsp;&lt;/td&gt;" +
                    "&lt;td&gt;" +
                    "&lt;div id='divButtons' class='createNew-buttonContainer'&gt;" +
                          "&lt;button id='createNewLink-cancel' class='k-button saveNewButtons' &gt;Cancel&lt;/button&gt;&amp;nbsp;" +
                          "&lt;button id='createNewLink-save' class='k-button saveNewButtons'&gt;Save&lt;/button&gt;" +
                    "&lt;/div&gt;" +
                    "&lt;/td&gt;" +
                    "&lt;/tr&gt;" +
                    "&lt;tr style='height: 80px;&gt;" +
                    "&lt;td&gt;" +
                    "&lt;div id='div-textboxes'&gt;" +
                  Html.Partial(_dynamicPartialView)
                    "&lt;/div&gt;" +
                    "&lt;/td&gt;" +
                    "&lt;/tr&gt;" +
            "&lt;/table&gt;" +
                  "&lt;/div&gt;" +
                  "&lt;/div&gt;" +
                  "&lt;/section&gt;'"
    ).Events(events =&gt; events.Close("onPopupClose"))
  </code></pre>
  
  <p>In the controller:</p>
  
  <pre><code> [HttpPost]
      public ActionResult GetUserFields(string Id)
      {
          if (!string.IsNullOrWhiteSpace(Id))
          {
              var fields = GetuserFields(int.Parse(Id));
  
              var model = new FieldModel
              {
                  Fields = fields 
              };
  
              return PartialView("_dynamicPartialView", model);
          }
  
          return null;
  }
  </code></pre>
  
  <p>Jquery works, and it takes me to the partial view  </p>
  
  <pre><code>    function onSelect(e) {
          e.preventDefault();
          var selectedId = this.dataItem(e.item).id;
  
          $.ajax({
              url: "@Url.Action("GetUserFields", "UserModel")",
              type: 'POST',
              cache: false,
              data: JSON.stringify({ Id: selectedId }),
              contentType: "application/json; charset=utf-8",
              dataType: "json"
          });
      }
  </code></pre>
  
  <p>Here is the partial view (_dynamicPartialView)</p>
  
  <pre><code>@model Models.UserFieldModel
  @using Kendo.Mvc.UI
  
  @if (Model != null)
  {
  foreach (var item in Model.UserFields)
  {
  &lt;p&gt;@item.FieldName&lt;/p&gt;
  
  if (item.FieldType.ToString().ToUpper() == "TEXTBOX")
  {
      if (item.IsCaseSensitiveField)
      {
          @(Html.Kendo().TextBox()
                  .Name("caseSensitive")
          )
       }
      else
      {
          @(Html.Kendo().TextBox()
                  .Name("textInput")
          )
      }
     }
   }
  }
  </code></pre>