My C# code:
[HttpGet]
public virtual JsonResult GetBrickByBrickId(int brickId)
{
var brick = brickAdminRepository.GetBrickByBrickId(brickId);
var data = new
{
BrickId = brick.BrickId,
TypeId = brick.TypeId,
Color = brick.Color,
Name = brick.Name,
NameBen = brick.NameBen,
Height = brick.Height,
Width = brick.Width,
Length = brick.Length,
Price = brick.Price,
Description = brick.Description,
DescriptionBen = brick.DescriptionBen,
CoverImageName = brick.CoverImageName,
CB = brick.CB,
MB = brick.MB,
CD = brick.CD,
MD = brick.MD,
IsPublished = brick.IsPublished
};
return Json(data, JsonRequestBehavior.AllowGet);
}
My JS code:
function OnLocationModify(brickId)
{
var url = '@Url.Action("GetBrickByBrickId", "BrickAdmin")';
$.ajax({
url: url,
type: 'get',
async:false,
data:
{
brickId: brickId,
},
success:function(data)
{
AllClear();
if(data!=null)
{
$('#BrickId').val(data.BrickId);
$('#TypeId').val(data.TypeId);
$('#Color').val(data.Color);
$('#Name').val(data.Name);
$('#NameBen').val(data.NameBen);
$('#Height').val(data.Height);
$('#Width').val(data.Width);
$('#Length').val(data.Length);
$('#Price').val(data.Price);
$('#Description').val(data.Description);
$('#DescriptionBen').val(data.DescriptionBen);
document.getElementById('IsPublished').checked = data.IsPublished;
}
},
error:function()
{
}
});
}
But it show error "An error occurred while processing your request". i analysis a lot and i found it. If i get 500 rows then it works fine but when data rows is greater than 500 rows then it show error. Please some one help me. How can i get large number of data by Json.