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

Set default value in insert EditFormSettings

3 Answers 197 Views
Grid
This is a migrated thread and some comments may be shown as answers.
pbarron
Top achievements
Rank 1
pbarron asked on 21 Apr 2008, 11:13 AM
I am using a RadGrid and I am having problems setting the value of a checkbox.
It seam to deafult to checked and I am not sure how to set it to unchecked.

This works for the update but not for the insert

 <asp:CheckBox ID="chkArchive" runat="server" Checked='<%# (DataBinder.Eval(Container.DataItem,"Archive").ToString()!="False"?true:false) %>' /> 

Thanks
Paul

3 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 22 Apr 2008, 08:27 AM
Hi pbarron,

The code snippet pasted leads me to believe that the Archive item is always evaluated to a value different than false.
Attached to this message, is a sample application, which handles a similar scenario. Take a look at it and let me know if this is the expected behavior.

Kind regards,
Yavor
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
pbarron
Top achievements
Rank 1
answered on 23 Apr 2008, 12:55 PM
I think I might have gone about it incorrectly.

Basically the checkbox is checking the data of  a  field that is a bit. 

Which is why it works correctly when you edit a record. So basically I need to tell it the default value when you insert a record.
0
Sebastian
Telerik team
answered on 25 Apr 2008, 07:24 AM
Hello pbarron,

Does the solution provided by my colleague Yavor applicable for you? Alternatively, to set default unchecked state for the asp CheckBox on init insert action, consider hooking the ItemCommand event of RadGrid (when e.CommandName is RadGrid.InitInsertCommandName) and set the checked state as illustrated in this documentation topic:

http://www.telerik.com/help/radcontrols/prometheus/?grdInsertingValuesInPlaceAndEditForms.html (paragraph Setting predefined values for different column editors)

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
pbarron
Top achievements
Rank 1
Answers by
Yavor
Telerik team
pbarron
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or