Quantcast
Channel: Active questions tagged return-value - Stack Overflow
Viewing all articles
Browse latest Browse all 207

How to get the value of selected text in select combobox by javascript in asp.net c#

$
0
0

How to get the value from selected text by select combobox?Here is the aspx.cs code for bind combobox

service.BindHTMLDropdownList(cmb_labelno, "tbl_StockRunning", "StockTagNo", "StockId", "where IsActive = 1 and StockTypePrefix = 'T' and " +"BranchId = " + Session["BranchId"] +"");

Combobox Name : cmb_labelnoTable Name : tbl_StockRunningText : StockTagNoValue : StockId

Here is the aspx code

<select id="cmb_labelno" runat="server"></select><input type="button" id="btnGetStock" value="VIEW"/>$("#btnGetStock").click(function (e) {                   alert(document.getElementById('cmb_labelno').value);});

Now, the place of alert(document.getElementById('cmb_labelno').value I usedalert(document.getElementById('cmb_labelno').val also still value is not showing.

While the same thing if I am doing in Jquery still showing the selectedtext only not valueHere is my Jquery code,

document.getElementById('<%= cmb_labelno.ClientID %>').value

Is there any problem in code...???


Viewing all articles
Browse latest Browse all 207

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>