Guest User

Untitled

a guest
Dec 13th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head runat="server">
  4. <meta charset="utf-8" />
  5. <title></title>
  6. </head>
  7.  
  8. <body>
  9. <form id="form1" runat="server">
  10. <div>
  11. <select>
  12. <option value="1">M&#179;/min</option>
  13. <option value="2">M&#179;/s</option>
  14. </select>
  15.  
  16. <asp:DropDownList ID="drp" runat="server"></asp:DropDownList>
  17.  
  18.  
  19. </div>
  20. </form>
  21. </body>
  22. </html>
  23.  
  24. public partial class MyPage: System.Web.UI.Page
  25. {
  26. private class idAndUnit
  27. {
  28. public int Id { get; set; }
  29. public string Unit { get; set; }
  30. }
  31.  
  32.  
  33. protected void Page_Load(object sender, EventArgs e)
  34. {
  35. var units = new List<idAndUnit>()
  36. {
  37. new idAndUnit
  38. {
  39. Id = 1,
  40. Unit = "M&#179;/min"
  41. },
  42. new idAndUnit
  43. {
  44. Id = 2,
  45. Unit = "M&#179;/min"
  46. }
  47. };
  48.  
  49.  
  50. drp.DataSource = units;
  51. drp.DataTextField = "Unit";
  52. drp.DataValueField = "Id";
  53. drp.DataBind();
  54.  
  55.  
  56. }
  57. }
  58.  
  59. <select>
  60. <option value="1">M&#179;/min</option>
  61. <option value="2">M&#179;/s</option>
  62. </select>
  63.  
  64. <select name="drp" id="drp">
  65. <option value="1">M&#179;/min</option>
  66. <option value="2">M&#179;/min</option>
Add Comment
Please, Sign In to add comment