Replies
Hai,
Please verify my below coding part for binding data using AJAX. If any error, Please suggest me.
In controller(C#)
public ActionResult Test(string partCode = "", string plantCode = "")
{
partList = (List<BOM_M_PARTS>)Session["SelectPart"];
return new JsonResult() { Data = partList, JsonRequestBehavior = JsonRequestBehavior.AllowGet };
}
Ajax call
$.ajax({
url: "../../NewRequest/Test",
dataType: 'json',
data: { partCode: partCode, plantCode: _plantData },
type: 'post',
success: function (data) {
if (data.length > 0) {
$("#GridPart").igGrid('option', 'dataSource', data);
$("#GridPart").igGrid("dataBind");
}}});
Please suggest me that above source code is correct or not
Thanks for your response… Please solve the below issue.
After rebind the grid using jquery,two header will display. Please help me to solve the issue
Thanks for your response… Please solve the below issue.
After rebind the grid using jquery,two header will display. Please help me to solve the issue
Here is the source Code
@(Html.Infragistics()
.Grid(Model)
.ID("GridPart")
.Height("500px")
.Width("100%")
.RenderCheckboxes(true)
.Features(feature =>
{
feature.Sorting().Mode(SortingMode.Single).ApplyColumnCss(true);
feature.Sorting();
feature.Paging().PageSize(25);
feature.Resizing();
})
.DataSourceUrl(Url.Action("DeptIndex"))
.UpdateUrl(Url.Action("OrdersSaveData"))
.DataBind()
.Height("500px")
.Render()
)
Script Code:
$("#txtPartCodeExisting").blur(
function () {
var partCode = $("#txtPartCodeExisting").val();
var _plantData = "";
$('input[id="chkPlant"]:checked').each(function (data, value) {
_plantData = _plantData + ':' + value.name;
}); debugger;
$.ajax({
url: "../..@Url.Action("GetPartDescByPartCode", "NewRequest")",
dataType: 'json',
type: 'post',
data: { partCode: partCode },
success: function (data) {
$("#txtPartDesc").val(data.partDesc);
$.ajax({
url: "../../NewRequest/Test",
dataType: 'json',
type: 'post',
success: function (data) {
debugger;
$("#GridPart").igGrid({
columns: [
{ headerText: "PRT_ID", key: "PRT_ID", dataType: "string" },
//{ headerText: "PRT_NAME", key: "PRT_NAME", dataType: "string" },
//{ headerText: "DEPT_NAME", key: "DEPT_NAME", dataType: "string" },
//{ headerText: "DEPT_TYPE", key: "DEPT_TYPE", dataType: "string" },
{ headerText: "isCheck", key: "isCheck", dataType: "bool" }
],
dataSource: data
});
$("#Grid").igGrid("dataBind");
},
error: function (xhr, ajaxOption, thrownError) {
swal({
text: "Respose Status:" + xhr.status + "\nError Type :" + ajaxOption + "\nResponse Text: " + xhr.responseText + "\nError: " + thrownError,
type: "warning",
title: "Warning"
});
},
cache: false
});
},
error: function (xhr, ajaxOption, thrownError) {
swal({
text: "Respose Status:" + xhr.status + "\nError Type :" + ajaxOption + "\nResponse Text: " + xhr.responseText + "\nError: " + thrownError,
type: "warning",
title: "Warning"
});
},
cache: false
});
}
);
Please send email any sample source