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

RadGrid CheckBoxes in EditForm

4 Answers 300 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 12 Apr 2011, 12:49 AM
hi all,
  
  I am using a Template Form to edit values from a RadGrid, When the grid is displayed the checkboxes appear to be properly bound, and are showing the correct "checked state", based on the value of 1 or 0 coming from the back-end.

  However, when I try to update from this edit form, I consistently get the error message "Cannot insert the value NULL into column DepositReceived ...."

   I can understand that on a new record ( INSERT ) that these values might be interpreted as NULL, however, as I've just returned the existing data, with valid checkbox values, I don't understand why they are still being seen as NULL ??? This is for all check boxes, including those which are "True" and checked ( please see attached image file )

   In the EditForm, I am binding as follows :
<asp:CheckBox ID="cbDepositReceived" runat="server" Checked='<%#Eval("DepositReceived") %>' />

  In the Grid, I am binding as follows :

<telerik:GridCheckBoxColumn DataField="DepositReceived" DataType="System.Boolean"
                                 HeaderText="DepositReceived" SortExpression="DepositReceived" UniqueName="DepositReceived"
                                 Visible="False" DefaultInsertValue="False" ConvertEmptyStringToNull="False">
                            </telerik:GridCheckBoxColumn>

  Any suggestions are very welcome -- I really don't want to have to deal with code-behind and hopefully I've missed something simple.

  thanks in advance
 b. stensrud
    

4 Answers, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 15 Apr 2011, 08:01 AM
Hi Brian,

Could you please try using the following code snippet into the EditForm markup for the Checkbox and let me know if the issue still exists:
<asp:CheckBox ID="cbDepositReceived" runat="server" Checked='<%#Bind("DepositReceived") %>' />

Looking forward for your reply.

Greetings,
Radoslav
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Brian
Top achievements
Rank 1
answered on 15 Apr 2011, 08:49 PM
hi Radoslav,

  Thanks for replying.

   Sorry -- I incorrectly typed  Checked='<%#Eval("DepositReceived") %>' in my post,
   but, I am actually already using Checked='<%#Bind("DepositReceived") %>' ...

 On further investigation of this issue :

 When I switched to "InLine" edits, the updating works correctly ( checkbox values and all ).

 It turns out that NONE of the values from my EditForm ( using Template ) are being passed to
  the datatsource, except the DataKeyName.

 So -- my actual problem is why when using EditForm with Template, and using the proper Bind() syntax, 
   the Datasource is not receiving these field values.

 thanks again
  b. stensrud
0
Radoslav
Telerik team
answered on 20 Apr 2011, 07:20 AM
Hello Brian,

Based on the supplied information, it is hard to determine what is causing the unwanted behavior at your end. Could you please post your aspx markup code with the related code behind file. Thus we will be able to gather more details about your scenario and provide you with more to-the-point answer.
Looking forward for your reply.

All the best,
Radoslav
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Brian
Top achievements
Rank 1
answered on 20 Apr 2011, 07:37 AM
Hi Radoslav,
  thanks for the quick response.

  It turns out to have been my "bad". I had inadvertently applied the "RunAt=Server" attribute to the tables used for the form template.
    This caused them to turn into "naming containers" and thus defeating the internals used to return data from the form .

   Resolved and thanks again
   b. stensrud
Tags
Grid
Asked by
Brian
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Brian
Top achievements
Rank 1
Share this question
or