Last post Nov 16, 2010 02:17 PM by tmmycat
Nov 16, 2010 09:45 AM|tmmycat|LINK
I have a question about the Dynamic Data API... trying to figure out how to get the value the user entered in an <asp:DynamicControl> that's in a different wizard step.
I am using an <asp:Wizard> as the entity template for one of my tables. This works well so far...I basically hijacked the Finish button of the wizard and make changed CommandName="Update" or CommandName="Insert" instead of the wizard default command, so
that the finish command will be treated as the update or insert command of the entity template. I also added <asp:DynamicControl>'s in the different steps for all of my fields which works nicely because I don't have to have custom code for each field. This
works very well and my records are edited and inserted successfully.
But I'm a bit puzzled about how to make the preview step ... I would need to look up the values that the user entered in the <asp:DynamicControl>'s in the previous steps, and I'm not sure how to do that. Seems like the process of getting values from those
fields is taken care of automatically when I edit or insert records and I'm not sure if there's a way to get the values manually.
Anyway I'll be investigating this today so I'll report back if I find an answer... thanks in advance!
Nov 16, 2010 10:08 AM|tmmycat|LINK
Here's what I ended up doing for now but I don't know if I'm reinventing the wheel...
In my field template I added this:
public string Text
So in the wizard PreviewStep_Activate event I can do this:
string myValue = DynamicControl1.FieldTemplate as Text_EditField).Text
I also saw a DataControl property in the field templates but didn't use that because I wanted to make it more encapsulated... (I didn't want other pages to have to make assumptions about the type of control that has the value.)
Nov 16, 2010 12:28 PM|sjnaughton|LINK
HI Tmmycat, you can also use the Extract Values method to get a dictionary of values from the page see:
/// Cloneable Extension
public static class CloneableExtensions
public static IOrderedDictionary ExtractEntityValues(this Control control, MetaTable table)
OrderedDictionary entityValues = new OrderedDictionary();
foreach (var column in table.Columns)
var fieldTemplate = control.FindFieldTemplate(column.Name) as IBindableControl;
if (fieldTemplate != null)
if(entityValues[column.Name] == null)
This is an except from this N41 DynamicData Extender project on
Dynamic Data 4
Nov 16, 2010 02:17 PM|tmmycat|LINK