I am having issues when using an edit template to create a new record. On insert, the same binding is assumed and does not work as there is nothng to bind to. For example, I have a date picker for which I have resricted the range from 2011 to 2050. On insert, there is no value being passed in and so an exception raised (Object cannot be cast from DBNull to other types.)
e.g.
<td>
<asp:CheckBox ID="Critical_E" runat="server" Text="Critical" Checked='<%# DataBinder.Eval( Container, "DataItem.Critical" ) %>' />
</td>
How do I either 1) disable the binding on insert, 2) create a separate insert template without having to create user controls?
Thanks,
Neil.