Making a Simple Ajax call to controller in mvc to load data into dropdownlist


 Public Function Get_Plant() As ActionResult
 Dim plantrole As New PlantRequestParam
 Dim rinfo = New Common.ResultInfo
 rinfo = iPlant.GetAllActiveList(plantrole)
 Return Json(rinfo)
End Function


var AjaxUrl = "../Home/Get_Plant";
 type: 'POST',
 url: AjaxUrl,
 contentType: 'application/json; charset=utf-8',
 success: function (data) {
 if (data.Status == true) {
 var taglist = data.Data;

$.each(taglist, function (index, value) {
 var opt = new Option(value.Name, value.Id);
 $(opt).attr('data-code', value.Code);

error: function (ex) {
 Message: AjaxUrl + "
" + ex.status + " - " + $(ex.responseText).filter('title').text(),
 Status: false

To load into HTML li tag:

$.each(taglist, function (index, value) {
 list.append('<li data-id="' + value.Id + '" data-name="' + value.Name + '" data-predictionperformance="'
 + value.PredictionPerformanceIndicator + '"><a>' + value.Code + '</a></li>');

Web Programming guide – Inserting data using SQL data source controller

In developing web base system, retrieving and inserting data is a basic thing. As in ASP.NET, it makes development easy. As we’re going to explore one of the control-SqlDataSource control which I have tested it out with a simple web application form name ‘NewContract.aspx’ in SCM test n error 2 project.


Continue reading