I have the following code which renders a control called ExchangeRates.ascx. I want to pass two variables to the control, currencyCode and toCurrencyCode but I only know how to pass one. Can anyone help?
<% var currencyCode = Html.Encode(Model.Country.CurrencyCode); %>
<% var toCurrencyCode = Html.Encode(Model.Country.toCurrencyCode); %>
<% Html.RenderPartial("~/Views/Shared/ExchangeRates.ascx", currencyCode); %>
You need to define a new model containing the two properties you are interested in:
and then strongly type your partial view to this model and pass an instance of it: