PJ McCormick
PJ McCormick

Reputation: 1993

KendoUI: TabStrip Content loading a partial that accesses the model from the parent

I've got a Tabstrip in KendoUI MVC, and I'm trying to load in content from partials. The partials need to access the model from the encapsulating view. I've been bashing my head against this for about an hour.

Here's what I've got:

@model NewAcctForms.Kendo.Models.VSInstModel

...

items.Add()
  .Text("Account Information")
  .Enabled(true)
  .Content(Html.Partial("NewAccountPartials/AccountInformation",NewAcctForms.Kendo.Models.VSInstModel).ToHtmlString()); 

And this is the compiler error that's coming back:

CS0119: 'NewAcctForms.Kendo.Models.VSInstModel' is a 'type', which is not valid in the given context

Can anyone please point me in the right direction here? Thanks!!

Upvotes: 0

Views: 2203

Answers (1)

Andrew Merritt
Andrew Merritt

Reputation: 307

Your first line defines the Model type. You can then reference it using Model.

.Content(Html.Partial("NewAccountPartials/AccountInformation",Model).ToHtmlString());

Actually, given that you are passing the model to the partial view, you probably should use:

.Content(Html.Action("AccountInformation","NewAccountPartials", Model));

Upvotes: 1

Related Questions