Working on a somewhat complex page for configuring customers at work. The setup is that there's a main page, which contains various "panels" for various groups of settings.
In one case, there's an email address field on the main table and an "export" configuration that controls how emails are sent out. I created amain panel that selects the company, and binds to a FormView. The FormView contains a Web User Control that handles the display/configuration of the export details.
The Web User Control Contains a property to define which Config it should be handling, and it gets the value from the FormView using Bind().
Basically the control is used like this:
<syn:ExportInfo ID="eiConfigDetails" ExportInfoID='<%# Bind("ExportInfoID" ) %>' runat="server" />
The property being bound is declared like this in CodeBehind:
public int ExportInfoID
{
get
{
return Convert.ToInt32(hfID.Value);
}
set
{
try
{
hfID.Value = value.ToString();
}
catch(Exception)
{
hfID.Value="-1";
}
}
}
Whenever the ExportInfoID is null I get a null reference exception, but the kicker is that it happens BEFORE it actually tries to set the property (or it would be caught in this version.)
Anyone know what's going on or, more importantly, how to fix it?