Last post Jul 28, 2009 10:15 AM by dcannon
Jul 15, 2009 09:27 AM|dcannon|LINK
Is it possible to use the MetaData layer defined DisplayName for a Field when being used in a DynamicControl?
I'm building a walkthrough interface on top of the flat dynamic data interface and I would rather not have the displayname duplicated in the code.
<asp:DynamicControl ID="DynamicControl1" runat="server" DataField="MRN" />
I tried switching the Label text to <%= DynamicControl1.HeaderText %> but that didn't work.
I'm sure there is an easy way to do this but I googled for it, then searched this forum with no luck.
Should I not be making a label to start with? It looks like in the field generators no label is made just the DynamicControl being created.
Jul 28, 2009 10:15 AM|dcannon|LINK
A week later, a week wiser or in this case 2.....
Kind of a duh moment but since I didn't get an answer and somebody else may run into this.
For anyone else looking for this just declare the metadata table in the codebehind and then reference the column entity name like below. I implemented the front page code tag inside a formview connected to a LinqDataSource but you can use any of the other
DataView types as well. You could also parameterize this into a display function to keep the indexes hidden/flexible.
In your aspx page
<%= (mtYourTable.Columns.Name) %>
where 9 is the index of whatever column your trying to get.