Forum
17:32
19/09/2013
I have an error like
Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
Details: Error parsing near '
<!DOCTYPE html PUB'.
My jqgrid is inside asp.net update panel.
This is my script:
$(document).ready(function() {
if ($.cookie("selectedTab") == null) {
$.cookie("selectedTab", 0);
}
$("#tabs").tabs({
activate: function(event, ui) {
$.cookie("selectedTab", $("#tabs").tabs("option", "active"));
},
active: $("#tabs").tabs({ active: $.cookie("selectedTab") })
});
MyJqGrid();
});
function MyJqGrid() {
$("#JGridCommodity").jqGrid({
//url: '../CF/CFJobCardNew.aspx?type=s',
//datatype: 'json',
//type: 'post',
datatype: function(postdata) {
mtype: "GET",
$.ajax({
url: "../CF/CFJobCardNew.aspx/BuildJGrid",
type: "post",
contentType: "application/json; charset=utf-8",
data: "{}",
dataType: "json",
success: function(data, st) {
if (st == "success") {
var grid = jQuery("#JGridCommodity")[0];
grid.addJSONData(JSON.parse(data.d));
//alert(data.d);
}
},
error: function() {
alert("Error with AJAX callback");
}
});
},
formatter: { number: { thousandsSeparator: ",", decimalSeparator: ".", decimalPlaces: 2, defaultValue: '0.00'} },
colNames: ['SlNo.', 'ContainerNo.', 'CommodityID', 'Commodity.', 'Description.', 'HSCode.', 'Marks & No.', 'PackageTypeID', 'Packages.', 'Pkg Qty.', 'UnitID', 'Unit.', 'Length.',
'Width', 'Height', 'Vol Weight', 'CBM', 'GrossWt(Kg)', 'NetWt(Kg)'],
colModel: [
{ name: 'SlNo', index: 'SlNo', editable: false, hidden: true, align: 'right', sorttype: 'int' },
{ name: 'ContainerNo', index: 'ContainerNo', align: 'left', width: 220, editable: true, editrules: { custom: true, custom_func: ContainerValidate }, formoptions: { rowpos: 1, colpos: 1} },
{ name: 'CommodityID', index: 'CommodityID', hidden: true, editable: true, editrules: { custom: true, custom_func: CheckCommodity }, formoptions: {} },
{ name: 'Commodity', index: 'Commodity', align: 'left', width: 350, editable: true, edittype: 'custom',
editoptions: { custom_element: comautocomplete_element, custom_value: autocomplete_value },
editrules: { custom: true, custom_func: CheckCommodity }, formoptions: { rowpos: 1, colpos: 2 }
},
{ name: 'Description', index: 'Description', width: 350, editable: true, formoptions: { rowpos: 1, colpos: 3} },
{ name: 'HSCode', index: 'HSCode', align: 'left', width: 150, editable: true, formoptions: { rowpos: 3, colpos: 1} },
{ name: 'MarksAndNo', index: 'MarksAndNo', align: 'left', width: 200, editable: true, formoptions: { rowpos: 3, colpos: 2} },
{ name: 'PackageTypeID', index: 'PackageTypeID', align: 'left', width: 200, hidden: true, edittype: 'select', editable: true, formoptions: { label: 'Package Type', rowpos: 3, colpos: 3 }, editrules: { custom: true, custom_func: packageValidation, edithidden: false },
editoptions: { dataUrl: '../Handler/SearchHandler.ashx?sType=pkg', dataEvents: [{ type: 'change', fn: function(e) {
//var thisval = $(e.target).val();
//$("#packages").val(thisval);
var lab = $('option:selected', this).text();
$("#packages").val(lab);
} }]
},
editrules: {}
},
{ name: 'packages', index: 'packages', width: 330, editable: true, hidden: false, formoptions: {}, editrules: { edithidden: true, hidedlg: true} },
{ name: 'PkgQty', index: 'PkgQty', align: 'left', width: 150, editable: true, editrules: { required: true, number: true }, formatter: "number", formoptions: { rowpos: 4, colpos: 1 },
editoptions: { dataEvents: [{ type: 'change', fn: function(e) { Calculate(); } }] }
},
{ name: 'UnitID', index: 'UnitID', align: 'left', width: 200, editable: true, hidden: true,
edittype: "select",
editoptions:
{
value: "0:;1:CENTIMETERS ;3:INCHES",
dataInit: function(elem) {
}, dataEvents: [{ type: 'change', fn: function(e) { $("#Unit").val($('option:selected', this).text()); } }]
}, formoptions: { label: 'Unit Type', rowpos: 4, colpos: 2 }, editrules: { edithidden: false }
},
{ name: 'Unit', index: 'Unit', editable: true, width: 250, formoptions: {}, editrules: { edithidden: true} },
{ name: 'length', index: 'length', align: 'right', width: 150, editable: true, editrules: { required: true, number: true }, formatter: "number", formoptions: { rowpos: 4, colpos: 3 },
editoptions: { dataEvents: [{ type: 'change', fn: function(e) { Calculate(); } }] }
},
{ name: 'width', index: 'width', align: 'right', width: 150, editable: true, editrules: { required: true, number: true }, formatter: "number", formoptions: { rowpos: 5, colpos: 1 },
editoptions: { dataEvents: [{ type: 'change', fn: function(e) { Calculate(); } }] }
},
{ name: 'height', index: 'height', align: 'right', width: 150, editable: true, editrules: { required: true, number: true }, formatter: "number", formoptions: { rowpos: 5, colpos: 2 },
editoptions: { dataEvents: [{ type: 'change', fn: function(e) { Calculate(); } }] }
},
{ name: 'VolWeight', index: 'VolWeight', align: 'right', width: 200, editable: true, formatter: "number", editrules: { edithidden: true }, formoptions: { rowpos: 6, colpos: 2 }, editoptions: { readonly: 'readonly'} },
{ name: 'CBM', index: 'CBM', align: 'right', width: 160, editable: true, formatter: "number", formoptions: { rowpos: 5, colpos: 3 },
editoptions: { dataEvents: [{ type: 'change', fn: function(e) { cbmchanged(); } }] }
},
{ name: 'GrossWt', index: 'GrossWt', align: 'right', width: 170, editable: true, editrules: { required: true, number: true }, formatter: "number", formoptions: { rowpos: 6, colpos: 1 },
editoptions: { dataEvents: [{ type: 'change', fn: function(e) { GrossChanged(); } }] }
},
{ name: 'NetWt', index: 'NetWt', align: 'right', width: 170, editable: true, editrules: { required: true, number: true }, formatter: "number", formoptions: { rowpos: 6, colpos: 3 }, editoptions: {} }
],
pager: jQuery('#pager'),
rowNum: 10,
rowList: [10, 20, 30, 40, 50],
sortname: 'SlNo',
sortorder: 'asc',
viewrecords: true,
jsonReader: { repeatitems: true },
width: 1120,
height: 150,
rownumbers: true,
caption: 'Add Commodity'
}).navGrid("#pager", { add: true, edit: true, del: true, search: false, refresh: true },
{ url: '../CF/CFJobCardNew.aspx', closeAfterEdit: true, width: 720,
editData: { SlNo: function() {
var sel_id = $('#JGridCommodity').jqGrid('getGridParam', 'selrow');
var value = $('#JGridCommodity').jqGrid('getCell', sel_id, 'SlNo');
return value;
}
}, beforeShowForm: function(form) { $('#tr_packages', form).hide(); $('#tr_Unit', form).hide(); }
},
{ closeAfterAdd: true, url: '../CF/CFJobCardNew.aspx', width: 720, beforeShowForm: function(form) { $('#tr_packages', form).hide(); $('#tr_Unit', form).hide(); } },
{ closeAfterDelete: true, url: '../CF/CFJobCardNew.aspx',
delData: { SlNo: function() {
var sel_id = $('#JGridCommodity').jqGrid('getGridParam', 'selrow');
var value = $('#JGridCommodity').jqGrid('getCell', sel_id, 'SlNo');
return value;
}
}
});
}
function ContainerValidate() {
if ($("#ContainerNo").val() != "") {
// var regexp = new RegExp(/^[A-Za-z]{4}\d{7}$/);
// container = $("#ContainerNo").val();
// if (regexp.test(container) == false)
// return [false, "Conatiner Number format should be like abcd1234567"];
// else
// return [true, ""];
var container = $("#ContainerNo").val();
var len = container.length;
var contregexp = new RegExp("^[a-zA-Z]{4}");
var contregexp1 = new RegExp("^[0-9]{7}$");
if (contregexp.test(container.substring(0, 4)) == false) {
invalidtype = 1;
}
else if (contregexp1.test(container.substring(4, 11)) == false) {
invalidtype = 2;
}
else
invalidtype = 0;
if (len < 11 || len > 11)
return [false, "Container Number should be 11 characters"];
else if (invalidtype == 1)
return [false, "First Four Characters should be Letters"];
else if (invalidtype == 2)
return [false, "Last Seven Characters Should be Numeric"];
else
return [true, ""];
}
else
return [true, ""];
}
function comautocomplete_element(value, options) {
// creating input element
var $ac = $('<input type="text"/>');
// setting value to the one passed from jqGrid
$ac.val(value);
// creating autocomplete
$ac.autocomplete({ source: "../Handler/SearchHandler.ashx?sType=com",
select: function(event, ui) {
event.preventDefault();
if (ui.item) { //txtAutoComp_current = ui.item;
}
$('#CommodityID').val(ui.item ? ui.item.value : 0);
$('#Commodity').val(ui.item.label);
},
change: function(event, ui) {
//$('#CommodityID').val(ui.item ? ui.item.value : 0);
//alert($("#CommodityID").val());
}
});
$('.ui-autocomplete').css('zIndex', 1000);
// returning element back to jqGrid
return $ac;
}
function packageValidation(value, colname) {
if ($("#packages").val() == 0)
return [false, "Packages is required"];
else
return [true, ""];
}
function UnitValidation(value, colname) {
if ($("#UnitID").val() == 0)
return [false, "Unit is required"];
else
return [true, ""];
}
function autocomplete_value(elem, op, value) {
if (op == "set") {
$(elem).val(value);
}
return $(elem).val();
}
function Calculate() {
len = $("#length").val();
wid = $("#width").val();
hei = $("#height").val();
qty = $("#PkgQty").val();
if (isNaN(len) || isNaN(wid) || isNaN(hei) || isNaN(qty))
return [false, "Invalid Inputs found"];
if ($("#UnitID").val() == 1)
result = (len * wid * hei * qty) / 6000;
else
result = (len * wid * hei * qty) / 366;
result = result.toFixed(2);
$("#VolWeight").val(result);
cbm = result / 166.66;
cbm = cbm.toFixed(2);
$("#CBM").val(cbm);
if (Get_cmbMode().get_selectedItem() == null)
return [true, ""];
if (Get_cmbMode().get_selectedItem().get_value() == 1) {
qt = 166.66;
result = parseFloat(cbm * qt);
result = result.toFixed(2);
gr = $("#GrossWt").val();
if (result > gr)
$("#NetWt").val(result);
}
}
function GrossChanged() {
grosswt = $("#GrossWt").val();
cbm = $("#CBM").val();
qty = $("#PkgQty").val();
if (isNaN(grosswt) || isNaN(cbm) || isNaN(qty))
return [false, "Invalid Inputs found"];
nwt = parseFloat(cbm * 166.66 * qty);
nwt = nwt.toFixed(2);
//alert(nwt);
if (Get_cmbMode().get_selectedItem() == null)
return [true, ""];
if (Get_cmbMode().get_selectedItem().get_value() == 1) {
if (grosswt > nwt)
$("#NetWt").val(grosswt);
else
$("#NetWt").val(nwt);
}
}
function cbmchanged() {
cbm = $("#CBM").val();
qty = $("#PkgQty").val();
if (isNaN(cbm) || isNaN(qty))
return [false, "Inavlid Input"];
result = parseFloat(cbm * 166.66 * qty);
result = result.toFixed(2);
if (Get_cmbMode().get_selectedItem() == null)
return [true, ""];
if (Get_cmbMode().get_selectedItem().get_value() == 1) {
gr = $("#GrossWt").val();
if (isNaN(gr))
return [false, "Inavlid GrossWt Input"];
if (result > gr)
$("#NetWt").val(result);
else
$("#NetWt").val(gr);
}
else
$("#GrossWt").val(result);
}
function CheckCommodity(value, colname) {
if ($('#CommodityID').val() == null || $('#Commodity').val() == '')
return [false, "Please select a commodity"];
else
return [true, ""];
}
function pageLoad(sender, args) {
if (args.get_isPartialLoad()) {
$("#tabs").tabs({
activate: function(event, ui) {
$.cookie("selectedTab", $("#tabs").tabs("option", "active"));
},
active: $("#tabs").tabs({ active: $.cookie("selectedTab") })
});
MyJqGrid();
}
//MyJqGrid();
$("#tabs").tabs({
activate: function(event, ui) {
$.cookie("selectedTab", $("#tabs").tabs("option", "active"));
},
active: $("#tabs").tabs({ active: $.cookie("selectedTab") })
});
}
Plz help..
Most Users Ever Online: 715
Currently Online:
38 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66