Hi I'm having some issues understanding how MVC 3 and razor work. Basically, I have a view that's rendered with Html.Render partial. basically, I'm trying to render the contents or a partial view inside of div like so.
<div id="mydiv.id">
@{Html.RenderPartial("_BankAccountGrid", Model.CheckAccounts);}
</div>
@if (Model.Any())
{
@{Html.Grid(Model).Columns(c =>
{
c.For(a => Html.ActionLink(
"Edit",
"EditBankAccountDetails",
"UserManagement",
new { Id = a.Id }, new { id = "modalEdit" }));
c.For(a => a.AccountName);
c.For(a => a.AccountNumber);
c.For(a => a.RoutingNumber);
c.For(a => a.BankName);
c.For(a => a.CheckAccountType);
c.For(a => a.AccountType_Id).Visible(false);
c.For(a => a.version).Visible(false);
c.For(a => a.IsDefault).Visible(false);
c.For(a => a.User_Id).Visible(false);
c.For(a => a.Id).Visible(false);
}).Render();
}
}
However when I look at the DOM in firebug the Table is ALWAYS rendered outside of the div in just a table element. I've tried this as well.
@{Html.RenderPartial("_BankAccountGrid", Model.CheckAccounts);}
@if (Model.Any())
{
<div id="accounts.grid.div">
@{Html.Grid(Model).Columns(c =>
{
c.For(a => Html.ActionLink(
"Edit",
"EditBankAccountDetails",
"UserManagement",
new { Id = a.Id }, new { id = "modalEdit" }));
c.For(a => a.AccountName);
c.For(a => a.AccountNumber);
c.For(a => a.RoutingNumber);
c.For(a => a.BankName);
c.For(a => a.CheckAccountType);
c.For(a => a.AccountType_Id).Visible(false);
c.For(a => a.version).Visible(false);
c.For(a => a.IsDefault).Visible(false);
c.For(a => a.User_Id).Visible(false);
c.For(a => a.Id).Visible(false);
}).Render();
}
</div>
}
.. but to no avail. Is there something I'm missing?
If I'm not clear enough or you just need more info please just ask instead of voting down.