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

Checkbox in EditForm

1 Answer 83 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 03 Aug 2008, 07:21 AM
I have placed a standard ASP:Checkbox control into a custom EditForm of a RadGrid. I'm trying to use <%# Bind("IsActive") #> to bind the control to a 'bit' field in a SQL Server 2005 database.

<asp:CheckBox ID="IsActive" runat="server" Checked=<%# Bind("IsActive") %>

Unfortunately when I attempt to insert a new record into the grid I get an "InvalidCast" exception.

When I attempt to update a record in the grid, no exceptions occur, however the underlying database record isn't updated.

Any ideas?



1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 04 Aug 2008, 05:57 AM
Hello Andrew,

 Can you try setting the Checked property of the CheckBox  as shown below.

aspx:
<asp:CheckBox ID="IsActive" Checked='<%#Bind("IsActive") %>'  runat="server" />  


Thanks
Princy.
Tags
Grid
Asked by
Andrew
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or