One good approach to bind data to controls inside the EditFormTemplate
would be by using the ItemDataBound
event of RadGrid. At this point, the being bound to the grid row is known and this data can be used to apply conditional formatting, binding data to child controls, etc... Unlike the ItemCreated
will only fire when data is bound to the grid. See Differences Between ItemCreated and ItemDataBound
, also check out the list of Commands that invoke Rebind Implicitly
When in ItemDataBound event, you can then try accessing the Controls inside the FormTemplate as described in the Accessing Cells and Rows
article. Sometimes, you might want to run different logic, when inserting a new record and different when editing. Following the Distinguish Edit or Insert Mode
article you can identify the edit mode and execute logics accordingly.
The suggestions from above will help you get started. You can also check out the sample project attached which shows how to bind data to a ComboBox inside the EditFormTemplate. (assemblies are not included to keep the file size to minimum)
I hope the suggestions will be helpful.
Get quickly onboarded and successful
with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.