i have a json stored in hidden field with given below data.
[
{"Column_ID":"cntName","Field_Value":"satyendra"},
{"Column_ID":"cntAddress","Field_Value":"Test"},
{"Column_ID":"cntDate ","Field_Value":"03"}
]
i have aspx page with html input control name same as column_id.
i want function in jquery which will read json and set value to html input control whose id is as given in column_id
how can i do this.
nishant ranjanPosted Feb 21, 2014, 2:02 AM
alert(json_object); gives
{"FieldValue":[
{"Column_ID":"txtEventNo","Field_Value":"satyendra"},{"Column_ID":"txtEventDesc","Field_Value":"Test"},
{"Column_ID":"txtDateOfBirth ","Field_Value":"03"}]}
i get error as 0x800a138f - JavaScript runtime error: Unable to get property 'length' of undefined or null reference in
for (var i = 0; i < json_object.FieldValue.length; i++)
{
document.getElementById(obj.FieldValue[i].Column_ID).innerHTML = obj.FieldValue[i].Field_Value;
}
any suggestion, where i am going wrong
nishant ranjanPosted Feb 20, 2014, 7:34 AM
"FieldValue":[
{"Column_ID":"txtEventNo","Field_Value":"satyendra"},{"Column_ID":"txtEventDesc","Field_Value":"Test"},
{"Column_ID":"txtDateOfBirth ","Field_Value":"03"}
]
kindly suggest