Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
In webforms if i created a Public Property in code, i could assign a value through the template. As an example if i have a property called
string DefaultName {get; set;}
then on my template i could do something like
<macro.... DefaultName="Michael"..../macro>
How could i do the same for a MVC template if my code is something like
@Html.Partial("~/Views/Partials/Test/Index.cshtml", new Web.Models.TestForm())
I tried with this but it never worked
@Html.Partial("~/Views/Partials/Test/Index.cshtml", new Web.Models.TestForm() new {DefaultName="Michael"})
Thanks
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
How to pass value from template to code behind?
In webforms if i created a Public Property in code, i could assign a value through the template. As an example if i have a property called
then on my template i could do something like
How could i do the same for a MVC template if my code is something like
I tried with this but it never worked
Thanks
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.