how to set(assign) dropdownlist selected value & radiobutton selected value in jquery from a json data

<asp:RadioButtonList ID="rblGender" runat="server" RepeatDirection="horizontal" Height="30px" Width="130px">
    <asp:ListItem Selected="True" Value="M">Male</asp:ListItem>
    <asp:ListItem Value="F">Female</asp:ListItem>

<asp:DropDownList ID="ddlDepartment" runat="server" Height="20px" Width="100px"  >

Based on a selected id (Webservice returns the details of the employee and i need to show it in the form) Id, Code , Name is working good

      type: "POST",
      url: "EMService.asmx/GetEmployeeById",
      data: "{ 'Id':'" + id + "' }",
      contentType: "application/json; charset=utf-8",
      dataType: "json",
      success: function (data) {
           var obj = data.d;
                error: function (result) {
            return false;


This could be a type while posting but you have missed the } closing brace of ajax success.

try to change this:


to this:


you have used valueOf and .value(obj(Department.Id), instead of use just .val() and this .value(obj(Department.Id)); should be .value(obj.Department.Id);

Need Your Help

Json Exception wrong type

java json eclipse gson

I use Gson in my project. But it returns me error

How to scroll to the bottom of a UITableView on the iPhone before the view appears

ios objective-c cocoa-touch uitableview

I have a UITableView that is populated with cells of a variable height. I would like the table to scroll to the bottom when the view is pushed into view.