Guest User

Untitled

a guest
May 20th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.49 KB | None | 0 0
  1. <%= Html.DropDownList ("WillAttend",new[]
  2. {
  3. new SelectListItem { Text = "Yes, I'll be there",Value=bool.TrueString},
  4. new SelectListItem { Text = "No, I can't come",Value=bool.FalseString}
  5. },"Choose an option"); %>
  6.  
  7. <body>
  8. <h1>RSVP</h1>
  9.  
  10. <% using(Html.BeginForm()) { %>
  11. <p> Your name: <%= Html.TextBox("Name") %></p>
  12. <p> Your email: <%= Html.TextBox("Email") %></p>
  13. <p> Your phone: <%= Html.TextBox("Phone") %></p>
  14. <p>
  15. Will you attend?
  16. <%= Html.DropDownList ("WillAttend",new[]
  17. {
  18. new SelectListItem { Text = "Yes, I'll be there",Value=bool.TrueString},
  19. new SelectListItem { Text = "No, I can't come",Value=bool.FalseString}
  20. },"Choose an option") %>
  21. </p>
  22. <input type="submit" value="Submit RSVP" />
  23. <% } %>
  24. </body>
  25.  
  26. <%
  27. Dim lst As New List(Of SelectListItem)
  28.  
  29. Dim item1 As New SelectListItem
  30. item1.Text = "Yes, I'll be there"
  31. item1.Value = Boolean.TrueString
  32. lst.Add(item1)
  33.  
  34. Dim item2 As New SelectListItem
  35. item2.Text = "No, I can't come"
  36. item2.Value = Boolean.FalseString
  37. lst.Add(item2)
  38. %>
  39. <%=Html.DropDownList("WillAttend", lst, "Choose an option")%>
  40.  
  41. <% Dim listItems As SelectListItem() = { _
  42. New SelectListItem() With {.Text = "Yes, I'll be there", .Value = Boolean.TrueString}, _
  43. New SelectListItem() With {.Text = "No, I can't come", .Value = Boolean.FalseString} _
  44. }
  45.  
  46. Response.Write(Html.DropDownList("WillAttend", listItems, "Choose an option"))
  47. %>
  48.  
  49. <p>Will you attend?</p>
  50. <select id="WillAttend">
  51. <option>Select an option</option>
  52. <option value="true">Yes, I'll be there</option>
  53. <option value="false">No, I can't come</option>
  54. </select>
  55.  
  56. <%: Html.DropDownListFor(Function(x) x.WillAttend, New List(Of SelectListItem) From _
  57. {
  58. New SelectListItem With {.Text = "Yes, I'll be there", .Value = Boolean.TrueString},
  59. New SelectListItem With {.Text = "No, I can't come", .Value = Boolean.FalseString}
  60. }, "Choose an option")%>
  61.  
  62. <p>
  63. Will you attend?
  64. <%= Html.DropDownListFor(x => x.WillAttend, new[] {
  65. new SelectListItem { Text = "Yes, I'll be there",
  66. Value = bool.TrueString },
  67. new SelectListItem { Text = "Yes, I'll be there",
  68. Value = bool.FalseString }
  69. }, "Choose an option") %>
  70. </p>
Add Comment
Please, Sign In to add comment