how to get the value of a kendoui dropdown list selected value in a listview

Posted by user1568738 on Stack Overflow See other posts from Stack Overflow or by user1568738
Published on 2012-10-31T04:55:41Z Indexed on 2012/10/31 5:01 UTC
Read the original article Hit count: 442

Filed under:
|
|

am having Some kendoui listviews which consists of kendoui dropdown lists and i want to get those dropdown list selected values. To do this am trying,

 $("#cnty1").val();

and here is my dropdownlist,i.e., list of countries coming from Database table,

<input select STYLE="width:90px;height:auto" id ="cnty1" data-bind="value:cnty1" 
name="cnty1" data-type="string" data-text-field="cnty" 
data-value-field="cntyid" data-source="sourcedata1" class="k-d"   
data-role="dropdownlist" />

<span data-for="cnty1" class="k-invalid-msg"></span>

here cnty1 is the id of the dropdown list, but am not getting the value instead am getting "id" of the slected value but not the selected value.

And also if the value is not selected am getting the first value id by using $("#cnty1").val();

So, please suggest me a solution so that, 1) I should get only the Selected value and 2) Value of the dropdown list Only if the user selects a value from the list, but don't get the value of the list without selecting.

© Stack Overflow or respective owner

Related posts about c#

Related posts about asp.net-mvc-3