Set ASP.Net DropDownList selected value using jQuery

Last Reply one year ago By dharmendr

Posted one year ago

hi..i want to retrieve and update database data to textbox and dropdownlist based on id..i am having a problem in displaying database data as selected index in dropdown list..

                     success: function (data) {
                         var empDetails = $.parseJSON(data.d);
                         $.each(empDetails, function (index, value) {
                              
                             $("#Txtname").val(value.name);
                             $("#Txtid").val(value.id);
                          
                             $("#TxtState").find("option:selected").text(value.state));//here data is retrieved..but repeating with present dropdownlist values..
                             //possibly looking to bring the database data to selected item index position in dropdownlist if matches...
                         });
                     },