Set selected value of dropdown in jquery asp.net

In this tutorial, I am going to show with you how you can set the selected value of dropdown in jquery with asp.net an Html control.  In this process, you need to call the Drop-Down id and use val() function with 'Selectedvalue' as the parameter.


                                        
So, Let's get started.

Step 1:
For Html Control
After success receive the value in a variable and set it

              <select id="ddlCity" class="form-control"></select>


        success: function (res)
        {
            debugger;
            var getval = res.d;
            document.getElementById('ddlCity').value = getval.city_sk;
        },
For Asp.net control
<asp:DropDownList runat="server" ID="ddlcity" />
$("#<%=ddlcity.ClientID%>").val("1");
Note:
Don't Forget to use jquery library, if you are using ajax process

Post a Comment

Post a Comment (0)

Previous Post Next Post