asp.net mvc - MVC Partial View is not rendering correctly in main View -


question background:

i have mvc partial view called actionlink method , renders dropdown list passed view model. add using twitter bootstrap framework within project.

the issue:

the partial view not being rendered correctly - button justified right looks added html not present in partial view html

code:

the main view calls components controller , getcomponents method

  <div class="jumbrotrontop">     <div class="jumbotron">         <h3><b>files release page</b></h3>         <div class="btn-toolbar">             <div class="btn-group">                      //*****partial view called*****                     @html.action("getcomponents", "component")             </div>             <div class="btn-group">                 <button class="btn btn-warning dropdown-toggle" type="button" data-toggle="dropdown">                     codebase <span class="caret"></span>                 </button>                 <ul class="dropdown-menu">                     <li><a href="#">action</a></li>                     <li><a href="#">another action</a></li>                     <li class="divider"></li>                     <li><a href="#">separated link</a></li>                 </ul>             </div>          </div>     </div> </div> 

getcomponents.cshtml - partial view:

@model toolsreleasepage.models.viewmodels.vmcomponentnamelist  <button class="btn btn-success dropdown-toggle" type="button" data-toggle="dropdown"> component <span class="caret"></span> </button> <ul class="dropdown-menu" id="componentnamelist">     <li><a href="#">action</a></li>     <li><a href="#">another action</a></li>     <li class="divider"></li>     <li><a href="#">separated link</a></li> </ul>  @foreach (var component in @model.componentnames) {     <script>        //call code populate dropdown list.     </script> } 

where issue seems be:

looking in console in chrome can see instead of pure html partial view seems being wrapped in following html - not know being added from:

<link rel="shortcut icon" type="image/x-icon" href="/content/loadingimagefavicon.ico"> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title></title>  <script src="/scripts/modernizr-2.6.2.js"></script>  <div class="container-fluid">  //partial view html 

i not know why html being added i'm sure fluid-container button being wrapped in issue. how render partial view not included html?

you returning view getcomponents action, when want return partialview.

a view render razor file using layout defined (or default layout), whereas partialview render razor view without layout.


Comments