This is a migrated thread and some comments may be shown as answers.

Error in Check Box inside Grid

1 Answer 18 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Anto (DLL Version : 2008.3.1314.35)
Top achievements
Rank 2
Anto (DLL Version : 2008.3.1314.35) asked on 03 Nov 2009, 10:31 AM
Hi All,

Have a Radgrid with a record in Check box.

AutomaticInsert="False"
AutomaticUpdate= "False"
AutomaticDelete = "False"

When Edit is clicked Works fine.

When Add New Recod is clicked Error appears

<telerik:GridTemplateColumn HeaderText="Is Earning?" UniqueName="Earning"   
                     DataField="Earning"  SortExpression="Earning">  
                       <ItemStyle HorizontalAlign="Center" Width="10%"  /><%--Width="70px"--%>  
                        <HeaderStyle HorizontalAlign="Center"  />  
                        <ItemTemplate>  
                        <asp:CheckBox ID="chkEarning" runat="server" Enabled="false"    
                        Checked='<%# Convert.ToBoolean(Eval("Earning")) %>'></asp:CheckBox>  
                        </ItemTemplate>  
                        <EditItemTemplate>  
                          <asp:CheckBox ID="chkEarningEdit" runat="server"                             
                          Checked='<%# Convert.ToBoolean(Eval("Earning")) %>'></asp:CheckBox>                           
                        </EditItemTemplate>  
                    </telerik:GridTemplateColumn> 

Object cannot be cast from DBNull to other types.

In the Check Box.

The Problem is while Add New Record, The Earning has the value NULL, How to rectify this.

-Anto

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 03 Nov 2009, 11:22 AM
Hello Anto,

Please examine the following links:

Known reasons for error messages (in the Note box)
Checkbox in FormTemplate- "Specified Cast is Invalid"

Best regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Anto (DLL Version : 2008.3.1314.35)
Top achievements
Rank 2
Answers by
Daniel
Telerik team
Share this question
or