Saturday, 15 May 2010

asp.net - Passing a string into a partial view in MVC4 -



asp.net - Passing a string into a partial view in MVC4 -

i'd able pass string partial view calling view - string different depending on view partial view rendered. this:

@{ html.renderpartial("partialviews/_breadcrumbspartial", "new item");}

or

@{ html.renderpartial("partialviews/_breadcrumbspartial", model.name);}

how can access sec parameter within partial view, since haven't labeled parameter? i'd avoid passing whole model in if possible, , reference string directly.

your partial must bind string

example, @ top place this:

@model string

to access value in partial, utilize @model in place of string param

asp.net asp.net-mvc asp.net-mvc-3 asp.net-mvc-4 razor

No comments:

Post a Comment