Веб-API
[HttpPost] //Get Vendor Master
public HttpResponseMessage GetVendorMaster(dynamic inXml)
{
string typeids = inXml.inXml;
int TypeID = Convert.ToInt32(typeids);
return new HttpResponseMessage()
{
Content = new StringContent(clsCommonLib.DataTableToJSON(MasterDetailsBO.GetVendorMaster(TypeID)), System.Text.Encoding.UTF8, "application/json")
};
}
Данные:
"[{" ID ": 14," trip_Name ":" One Way "}, {" ID ": 15," trip_Name ":" Two Way "}, {" ID ": 16," trip_Name ":" Multi City " "}]"
Метод Ajax:
function bind()
{
$.ajax({
type: "POST",
url: vUrlWithClass,
contentType: "application/json;",
data: param,
async: false,
dataType: "json",
success: function (data) {
var result = $.parseJSON(data.d)
console.log(data)
$.each(result, function (index, list) {
var rdb = "<tr><td><input id=rb" + this['Text'] + " type='radio' name='rbCategories' value=" + this['Text'] + " /><label for=lbl" + this['Text'] + ">" + this['Text'] + "</label></td></tr>";
table.append(rdb);
//$("#cphDashboard_ddlJourneytype").append($("<option></option>").val(list.ID).html(list.journey_Name));
})
},
error: function (result) {
console.log(result)
alert(result)
}
});
}
}
Код ASPX:
<asp:RadioButtonList ID="rdbJourneyTypeAir" runat="server" RepeatDirection="Horizontal" CssClass="FormatRadioButtonList">
</asp:RadioButtonList>
Но я не могу связать данные с помощью списка радиокнопок