you need to overwrite RelatedProducts view component's code because it's input param is fixed
i want to pass parameter to _ProductBox.cshtml. In version 3.9 i used ViewData and passed the parameter like this Html.Partial("_ProductBox", product, new ViewDataDictionary { { "p", "list" } }).
In __ProductBox I took the parameter like this: string val = this.ViewData.ContainsKey("p") ? this.ViewData["p"].ToString() : string.Empty;
Everything worked until I switched to version 4.5. In 4.5 @await Html.PartialAsync("_ProductBox", product). How to correctly pass the parameter in the new version?
you need to overwrite RelatedProducts view component's code because it's input param is fixed
i want to pass parameter to _ProductBox.cshtml. In version 3.9 i used ViewData and passed the parameter like this Html.Partial("_ProductBox", product, new ViewDataDictionary { { "p", "list" } }).
In __ProductBox I took the parameter like this: string val = this.ViewData.ContainsKey("p") ? this.ViewData["p"].ToString() : string.Empty;
Everything worked until I switched to version 4.5. In 4.5 @await Html.PartialAsync("_ProductBox", product). How to correctly pass the parameter in the new version?
Thanks.
Please try the following approach: @await Html.PartialAsync("_ProductBox", product, new ViewDataDictionary(this.ViewData){ { "p", "list" } })
you need to overwrite RelatedProducts view component's code because it's input param is fixed
i want to pass parameter to _ProductBox.cshtml. In version 3.9 i used ViewData and passed the parameter like this Html.Partial("_ProductBox", product, new ViewDataDictionary { { "p", "list" } }).
In __ProductBox I took the parameter like this: string val = this.ViewData.ContainsKey("p") ? this.ViewData["p"].ToString() : string.Empty;
Everything worked until I switched to version 4.5. In 4.5 @await Html.PartialAsync("_ProductBox", product). How to correctly pass the parameter in the new version?
Thanks.
Please try the following approach: @await Html.PartialAsync("_ProductBox", product, new ViewDataDictionary(this.ViewData){ { "p", "list" } })
Parameter p didn't get value "list"
string val = this.ViewData.ContainsKey("p") ? this.ViewData["p"].ToString() : string.Empty;
you need to overwrite RelatedProducts view component's code because it's input param is fixed
i want to pass parameter to _ProductBox.cshtml. In version 3.9 i used ViewData and passed the parameter like this Html.Partial("_ProductBox", product, new ViewDataDictionary { { "p", "list" } }).
In __ProductBox I took the parameter like this: string val = this.ViewData.ContainsKey("p") ? this.ViewData["p"].ToString() : string.Empty;
Everything worked until I switched to version 4.5. In 4.5 @await Html.PartialAsync("_ProductBox", product). How to correctly pass the parameter in the new version?
Thanks.
Please try the following approach: @await Html.PartialAsync("_ProductBox", product, new ViewDataDictionary(this.ViewData){ { "p", "list" } })
thank. everything is working )
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.