When i click on my insert record button it is giving me an error about Conversion from type 'DBNull' to type 'Boolean' is not valid. I would think that i knows not to use these databinding since this is for updating and not inserting the data. I have a custom form that I am using but the same for should be used for inserting as well.
I know the update protion is correct but is the insert portion correct for using the radgrid insert record button.
Error
<
EditFormSettings
EditFormType
=
"Template"
>
<
FormTemplate
>
<
table
width
=
"100%"
>
<
tr
>
<
td
style
=
"width:10%"
align
=
"right"
>Mac Type: </
td
>
<
td
style
=
"width:15%"
align
=
"left"
><
asp:DropDownList
ID
=
"ddlMacType"
runat
=
"server"
AutoPostBack
=
"false"
Width
=
"205px"
></
asp:DropDownList
></
td
>
<
td
style
=
"width:10%"
align
=
"right"
>SSN: </
td
>
<
td
style
=
"width:15%"
align
=
"left"
><
asp:TextBox
ID
=
"txtSSN"
runat
=
"server"
Width
=
"200px"
Text='<%# Bind("strSSN") %>'></
asp:TextBox
></
td
>
<
td
style
=
"width:10%"
align
=
"right"
>EDIPI: </
td
>
<
td
style
=
"width:15%"
align
=
"left"
><
asp:TextBox
ID
=
"txtEDIPI"
runat
=
"server"
Width
=
"200px"
Text='<%# Bind("strEDIPI") %>'></
asp:TextBox
></
td
>
<
td
style
=
"width:10%"
align
=
"right"
>AKO Logon: </
td
>
<
td
style
=
"width:15%"
align
=
"left"
><
asp:TextBox
ID
=
"txtAKO"
runat
=
"server"
Width
=
"200px"
Text='<%# Bind("strAkoLogon") %>'></
asp:TextBox
></
td
>
</
tr
>
<
tr
>
<
td
style
=
"height:5px"
></
td
>
</
tr
>
<
tr
>
<
td
style
=
"width:10%"
align
=
"right"
>LName: </
td
>
<
td
style
=
"width:15%"
align
=
"left"
><
asp:TextBox
ID
=
"txtLName"
runat
=
"server"
Width
=
"200px"
Text='<%# Bind("strLName") %>'></
asp:TextBox
></
td
>
<
td
style
=
"width:10%"
align
=
"right"
>FName: </
td
>
<
td
style
=
"width:15%"
align
=
"left"
><
asp:TextBox
ID
=
"txtFname"
runat
=
"server"
Width
=
"200px"
Text='<%# Bind("strFname") %>'></
asp:TextBox
></
td
>
<
td
style
=
"width:10%"
align
=
"right"
>MI: </
td
>
<
td
style
=
"width:15%"
align
=
"left"
><
asp:TextBox
ID
=
"txtMI"
runat
=
"server"
Width
=
"200px"
Text='<%# Bind("strMI") %>'></
asp:TextBox
></
td
>
<
td
style
=
"width:10%"
align
=
"right"
>Gen Qual: </
td
>
<
td
style
=
"width:15%"
align
=
"left"
><
asp:DropDownList
ID
=
"ddlGenQual"
runat
=
"server"
AutoPostBack
=
"false"
Width
=
"205px"
></
asp:DropDownList
></
td
>
</
tr
>
<
tr
>
<
td
style
=
"height:5px"
></
td
>
</
tr
>
<
tr
>
<
td
style
=
"width:10%"
align
=
"right"
>Emp Type: </
td
>
<
td
style
=
"width:15%"
align
=
"left"
><
asp:DropDownList
ID
=
"ddlEmpType"
runat
=
"server"
AutoPostBack
=
"false"
Width
=
"205px"
></
asp:DropDownList
></
td
>
<
td
style
=
"width:10%"
align
=
"right"
>Rank/Salutation: </
td
>
<
td
style
=
"width:15%"
align
=
"left"
><
asp:DropDownList
ID
=
"ddlSalutation"
runat
=
"server"
AutoPostBack
=
"false"
Width
=
"205px"
></
asp:DropDownList
></
td
>
<
td
style
=
"width:10%"
align
=
"right"
>Job Title: </
td
>
<
td
style
=
"width:15%"
align
=
"left"
><
asp:TextBox
ID
=
"txtJobTitle"
runat
=
"server"
Width
=
"200px"
Text='<%# Bind("strJobTitle") %>'></
asp:TextBox
></
td
>
<
td
style
=
"width:10%"
align
=
"right"
>Pick Unit: </
td
>
<
td
style
=
"width:15%"
align
=
"left"
><
asp:DropDownList
ID
=
"ddlunit"
runat
=
"server"
AutoPostBack
=
"false"
Width
=
"205px"
></
asp:DropDownList
></
td
>
</
tr
>
<
tr
>
<
td
style
=
"height:5px"
></
td
>
</
tr
>
<
tr
>
<
td
style
=
"width:10%"
align
=
"right"
>Requires Email: </
td
>
<
td
style
=
"width:15%"
align
=
"left"
><
asp:CheckBox
ID
=
"cbEmail"
runat
=
"server"
Checked='<%# Bind("bitEmail") %>' /></
td
>
<
td
style
=
"width:10%"
align
=
"right"
>Military Phone: </
td
>
<
td
style
=
"width:15%"
align
=
"left"
><
asp:TextBox
ID
=
"txtPhone"
runat
=
"server"
Width
=
"200px"
Text='<%# Bind("strPhoneNumber") %>'></
asp:TextBox
></
td
>
<
td
style
=
"width:10%"
align
=
"right"
>Requires LD: </
td
>
<
td
style
=
"width:15%"
align
=
"left"
><
asp:CheckBox
ID
=
"cbLD"
runat
=
"server"
Checked='<%# Bind("bitLongDistance") %>' /></
td
>
<
td
style
=
"width:10%"
align
=
"right"
>Requires VM: </
td
>
<
td
style
=
"width:15%"
align
=
"left"
><
asp:CheckBox
ID
=
"cbVM"
runat
=
"server"
Checked='<%# Bind("bitVoiceMail") %>' /></
td
>
</
tr
>
<
tr
>
<
td
style
=
"height:5px"
></
td
>
</
tr
>
<
tr
>
<
td
style
=
"width:10%"
align
=
"right"
></
td
>
<
td
style
=
"width:15%"
align
=
"left"
></
td
>
<
td
style
=
"width:10%"
align
=
"right"
>Zero Out: </
td
>
<
td
style
=
"width:15%"
align
=
"left"
><
asp:TextBox
ID
=
"txtZeroOut"
runat
=
"server"
Width
=
"200px"
Text='<%# Bind("strVoiceExt") %>'></
asp:TextBox
></
td
>
<
td
style
=
"width:10%"
align
=
"right"
>Notes: </
td
>
<
td
style
=
"width:15%"
align
=
"left"
><
asp:TextBox
ID
=
"txtNotes"
runat
=
"server"
Width
=
"260px"
TextMode
=
"MultiLine"
Height
=
"60px"
Text='<%# Bind("strNotes") %>'></
asp:TextBox
></
td
>
<
td
style
=
"width:10%"
align
=
"right"
></
td
>
<
td
style
=
"width:15%"
align
=
"left"
></
td
>
</
tr
>
<
tr
>
<
td
style
=
"height:5px"
></
td
>
</
tr
>
</
table
>
<
table
width
=
"100%"
>
<
tr
>
<
td
style
=
"width:25%"
></
td
>
<
td
style
=
"width:50%"
align
=
"center"
>
<
asp:LinkButton
ID
=
"lnkSubmit"
runat
=
"server"
text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>'
CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>'></
asp:LinkButton
>
<
asp:LinkButton
ID
=
"lnkCancel"
runat
=
"server"
CausesValidation
=
"false"
CommandName
=
"Cancel"
Text
=
"Cancel"
></
asp:LinkButton
>
</
td
>
<
td
style
=
"width:25%"
></
td
>
</
tr
>
</
table
>
</
FormTemplate
>
</
EditFormSettings
>
I know the update protion is correct but is the insert portion correct for using the radgrid insert record button.
If (e.CommandName = RadGrid.PerformInsertCommandName) Then
End If
If (e.CommandName = RadGrid.UpdateCommandName AndAlso e.Item.IsInEditMode) Then
End if
Error
Conversion from type 'DBNull' to type 'Boolean' is not valid.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidCastException: Conversion from type 'DBNull' to type 'Boolean' is not valid.
Source Error:
Line 85: <
tr
>
Line 86: <
td
style
=
"width:10%"
align
=
"right"
>Requires Email: </
td
>
Line 87: <
td
style
=
"width:15%"
align
=
"left"
><
asp:CheckBox
ID
=
"cbEmail"
runat
=
"server"
Checked='<%# Bind("bitEmail") %>' /></
td
>
Line 88: <
td
style
=
"width:10%"
align
=
"right"
>Military Phone: </
td
>
Line 89: <
td
style
=
"width:15%"
align
=
"left"
><
asp:TextBox
ID
=
"txtPhone"
runat
=
"server"
Width
=
"200px"
Text='<%# Bind("strPhoneNumber") %>'></
asp:TextBox
></
td
>