In this Article, I explain how to get selected dropdown value usingj query in asp.net. Here I am using jquery 1.8.3 for achieve this. Here I demonstrate a simple example of binding a country with dropdownlist.
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
function getvalue() {
var cbocountry = $('#cbocountry');
var selectedvalue = $('#cbocountry').val();
alert(selectedvalue);
}
</script>
<asp:DropDownList ID="cbocountry" runat="server">
<asp:ListItem Text="India" Selected="True" Value="1" />
<asp:ListItem Text="UAE" Value="2" />
<asp:ListItem Text="KSA" Value="3" />
</asp:DropDownList>
<asp:Button ID="Button1" runat="server" Text="Getselectedvalue" OnClientClick="getvalue()" />
Post your comments / questions
Recent Article
- How to Enable Virtualization in BIOS Security Settings in Intel Processors For Android Studio?
- Dependency 'androidx.activity:activity:1.8.0' requires libraries and applications that depend on it.
- AttributeError: 'NoneType' object has no attribute 'get_text' - Python
- ModuleNotFoundError: No module named 'openpyxl' - Python
- How to get thumbnail from vimeo video URL in Python?
- Remove all special characters, punctuation except spaces from string - Python
- OSError: cannot write mode RGBA as JPEG- Python
- expected str, bytes or os.PathLike object, not JpegImageFile - Python
Related Article