Last post Dec 07, 2010 02:24 PM by sjnaughton
Dec 07, 2010 11:20 AM|lahoriboy|LINK
I may need t o do some coding for some entities and write some custom logic. Humm, i have no idea how to write code for the entityTemplate. How can i access the controls (DynamicControl
If i need to add item or remove them or override some methods what should i do. Please give me some starting point, if you have some code that would be great. Thanks,
Dec 07, 2010 12:47 PM|sjnaughton|LINK
Hi Osman the Entity Template is for layout only really. you should look at implementing Business Login in your data model.
Dynamic Data 4
Dec 07, 2010 01:20 PM|lahoriboy|LINK
very true. In my case, i need to do some filtering and i don't want to do that in the fieldtemplate. Its just for one field and i was thinking not to create user control if its not reuseable. So, even if i create the fieldtemplate the business
logic is still in the UI ( although you can argue on the UIHint). Anyways, (2) technically is it even possible to code in the EntityTemplate and access the dynamic control ?
Dec 07, 2010 01:37 PM|sjnaughton|LINK
technically is it even possible to code in the EntityTemplate and access the dynamic control ?
Dec 07, 2010 01:51 PM|lahoriboy|LINK
Same old question again, then how to access the dynamic Control ?
Dec 07, 2010 02:24 PM|sjnaughton|LINK
I usually use this extension mehod:
/// Get the control by searching recursively for it.
/// <param name="Root">The control to start the search at.</param>
/// <param name="Id">The ID of the control to find</param>
/// <returns>The control the was found or NULL if not found</returns>
public static DynamicControl FindDynamicControlRecursive(this Control root, string dataField)
var dc = root as DynamicControl;
if (dc != null)
if (String.Compare(dc.DataField, dataField, true) == 0)
foreach (Control Ctl in root.Controls)
var FoundCtl = Ctl.FindDynamicControlRecursive(dataField);
if (FoundCtl != null)
You would use it like this:
var fieldTemplate = FornView.FindDynamicControlRecursive("ColumnName");