Created
October 14, 2020 12:13
-
-
Save anova/bfcce3508a9052aad43066bece7eb3c0 to your computer and use it in GitHub Desktop.
Pass a variable to partial (asp.net razor c# cshtml)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@{ | |
double rating = 0; | |
if (this.ViewData.ContainsKey("Rating")) | |
{ | |
rating = Convert.ToDouble(ViewData["Rating"]); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Html.Partial("_Rating", new ViewDataDictionary { { "Rating", 2.5 }, { "CommentCount", 305 } }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment