Such as the following code
to obtain the value
The HTML code
<body>
<form id="form1" runat="server">
<div>
<div>
<select id="select1" runat="server">
<option value ="video1" runat="server">video 1</option>
<option value ="video2" runat="server">video 2</option>
<option value="video3" runat="server">video 3</option>
</select>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="start" />
</div>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
C # code
protected void Button1_Click(object sender, EventArgs e)
{
String str = select1.Items[select1.SelectedIndex].Value;//Get the value of the drop-down list
Label1.Text = str; // Display the values in the list through the Lable component
}
String STR = select1.items [select1.selecteDindex].Value;
in the select1
for HTML code to theselect components
id
get Text
Text
>e> v>String STR = sel>.items [select1.selecteDindex].Value;
in theValue
instead. The Text
Read More:
- Sublime text 3 compiles and executes C/C++ programs directly
- How to Use Apt get Command Under Mac OSX
- Shell: How to Get System Current Tme and Format it
- C# WPF Framework: How to Build Caliburn.Micro Quickly
- C#: How to Use Itextsharp to Manipulate PDF Files
- How to Solve C++ Error: “no matching function for call to ‘atoi/atof’”
- [Solved] Linux C++ warning: ISO C++ forbids converting a string constant to ‘char*‘ [-Wwrite-strings]
- [Solved] Error: no “print“ mailcap rules found for type “text/plain“
- Ubuntu 20.04 Desktop Install sublime-text Error: “Certificate verification failed”
- [Solved] Error :: You must put some ‘source‘ URIs in your sources.list
- [Solved] Ubuntu Eclipse C/C++ Error: launch failed.binary not found
- [Ubuntu] How to Solve dpkg Error: dpkg: error: failed to open package info file ‘/usr/local/var/lib/dpkg/status’ for reading: No such file or directory
- Using apt get to delete software completely
- linux C called object ‘maze’ is not a function or function pointer printf(“%d\t“, maze(i, j))
- [Solved] xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory #include <expat.h>
- C# WinForm gets the storage path of the selected file
- MAC: Clion configure C compiler Error: The C compiler identification is unknown
- C# implementation of TXT document to table example code
- [Solved] ERROR: error loading sources list: The read operation timed out
- How to Create Threads in Linux