Definition of variables in use:
Guid fldProId = (Guid)ffdPro.GetProperty('FieldId'); string fldProValue = (string)ffdPro.GetProperty('FieldValue'); FormFieldDef fmProFldDef = new FormFieldDef(); fmProFldDef.Key = fldProId; fmProFldDef.Retrieve(); string fldProName = (string)fmProFldDef.GetProperty('FieldName'); string fldProType = (string)fmProFldDef.GetProperty('FieldType');
Lines giving the problem (specifically line 4 (hTxtBox.Text = …)):
if (fldProType.ToLower() == 'textbox') { Label hTxtBox = (Label)findControl(fldProName); hTxtBox.Text = fldProValue; }
All data is gathered from the database correctly, however the label goes screwy. Any ideas?
Are you sure that findControl is returning a value?
Is hTxtBox.Text a property that does any computation on a set that could be throwing the NullReferenceException?