Advertisement
why_where_what

Radio Buttons

Nov 18th, 2018
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.24 KB | None | 0 0
  1. @model ProductType
  2.  
  3.  
  4. @{
  5.     ViewData["Title"] = "Product Type";
  6. }
  7.  
  8. @Html.LabelFor(x => x, "Food")
  9. @if (Model == ProductType.Food)
  10. {
  11.     @Html.RadioButtonFor(x => x, (int)ProductType.Food, new { @checked = "checked" });
  12. }
  13. else
  14. {
  15.     @Html.RadioButtonFor(x => x, (int)ProductType.Food);
  16. }
  17.  
  18. @Html.LabelFor(x => x, "Cosmetic")
  19. @if (Model == ProductType.Cosmetic)
  20. {
  21.     @Html.RadioButtonFor(x => x, (int)ProductType.Cosmetic, new { @checked = "checked" });
  22. }
  23. else
  24. {
  25.     @Html.RadioButtonFor(x => x, (int)ProductType.Cosmetic);
  26. }
  27.  
  28. @Html.LabelFor(x => x, "Domestic")
  29. @if (Model == ProductType.Domestic)
  30. {
  31.     @Html.RadioButtonFor(x => x, (int)ProductType.Domestic, new { @checked = "checked" });
  32. }
  33. else
  34. {
  35.     @Html.RadioButtonFor(x => x, (int)ProductType.Domestic);
  36. }
  37.  
  38. @Html.LabelFor(x => x, "Health")
  39. @if (Model == ProductType.Health)
  40. {
  41.     @Html.RadioButtonFor(x => x, (int)ProductType.Health, new { @checked = "checked" });
  42. }
  43. else
  44. {
  45.     @Html.RadioButtonFor(x => x, (int)ProductType.Health);
  46. }
  47.  
  48. @Html.LabelFor(x => x, "Other")
  49. @if (Model == ProductType.Other)
  50. {
  51.     @Html.RadioButtonFor(x => x, (int)ProductType.Other, new { @checked = "checked" });
  52. }
  53. else
  54. {
  55.     @Html.RadioButtonFor(x => x, (int)ProductType.Other);
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement