ASP.Net/HTML Control/ComboBox

Материал из .Net Framework эксперт
Версия от 11:53, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

ComboBox(HTML Input Radio Button): get selected value (VB.net)

<%@ Page Language=VB Debug=true %>
<script runat=server>
Sub SubmitBtn_Click(Source As Object, E as EventArgs)
    MyMessage.InnerHTML = "You selected as your " _
        & "favorite meal: " & Meal.Value
End Sub
</SCRIPT>
<HTML>
<HEAD>
<TITLE>Allowing Input through the HTMLInputRadioButton Control</TITLE>
</HEAD>
<BODY>
<form runat="server">
<Span id="MyMessage" runat=server>
</Span>    
<BR>
Which is your favorite meal?  
<BR>
<select
    id="meal"
    runat="Server"
    multiple="False"
    size=1
>
    <option>Breakfast</option>
    <option>Lunch</option>
    <option>Dinner</option>
</select>
<BR>
<button 
    id="Button1"
    runat="server"
    onserverclick="SubmitBtn_Click" 
>
Submit
</button>
</Form>
</BODY>
</HTML>



HTML Control: get value from select (ComboBox) (C#)

<%@Page Language="C#" %>
<html><body>
  <form runat=server>
    <h3>Enter name: <input name="_name" id="_name" runat=server type=text/>
        
    Personality: <select runat=server name="_personality" id="_personality">
      <option>extraverted</option>
      <option>introverted</option>
      <option>in-between</option>
    </select>
    <input type=submit name="_lookup" value="Submit"></input>
    <p>
    <%
      if (IsPostBack)
        Response.Output.Write("Hi {0}, you selected {1}",
              _name.Value, _personality.Value);
    %>
    </p>  </form></body></html>