Hi,

I have an EDM model, which I'm rendering using DynamicData pages.

I need to add a derived/calculated field.

For example, in a "Person" entity, I have LastName and FirstName. I need to
add a derived field FullName (being LastName + ", " + FirstName)

I have tried adding the FullName field to Person's EDM partial class, and
set the column to be scaffolded, however I can't get FullName to display.

Any tips on how to get derived fields to show in DynamicData pages?

Thanks,
+Mark

Re: DynamicData pages and additional fields on an EDM model by Elmer

Elmer
Wed Sep 03 12:21:37 CDT 2008

- Create a partial Class of your entity
- Add a Public ReadOnly Property for the compute column
- Add atrtribute ScaffoldColumnAttribute(True) to the Property

Atte. Elmer Carías
DCE 4
El Salvador , Central America



"markla" <markla@noemail.noemail> escribió en el mensaje
news:ucyeNGZDJHA.4732@TK2MSFTNGP04.phx.gbl...
> Hi,
>
> I have an EDM model, which I'm rendering using DynamicData pages.
>
> I need to add a derived/calculated field.
>
> For example, in a "Person" entity, I have LastName and FirstName. I need
> to add a derived field FullName (being LastName + ", " + FirstName)
>
> I have tried adding the FullName field to Person's EDM partial class, and
> set the column to be scaffolded, however I can't get FullName to display.
>
> Any tips on how to get derived fields to show in DynamicData pages?
>
> Thanks,
> +Mark



RE: DynamicData pages and additional fields on an EDM model by v-alchen

v-alchen
Thu Sep 04 01:05:54 CDT 2008

Hi Mark,

Due to current limitation of Entity Data Model we cannot achieve this by
adding a scaffold property in the partial class.

I have two suggestions for you that can work it around:

1. You can customize the page template. Please refer to this video:
http://www.asp.net/learn/3.5-sp1/video-293.aspx

You can set AutoGenerateColumns to true and add an extra column. Something
like this:
<asp:GridView AutoGenerateColumns="True" ID="GridView1" runat="server"
DataSourceID="GridDataSource"
AllowPaging="True" AllowSorting="True" CssClass="gridview">
<Columns>
<asp:TemplateField>
<HeaderTemplate>
FullName
</HeaderTemplate>
<ItemTemplate>
<%#Eval("FirstName").ToString() + "," +
Eval("LastName").ToString() %>
</ItemTemplate></asp:TemplateField>
<asp:TemplateField>

2. You can hide the LastName field and use a custom field template for the
FirstName field. To do this, Add a FullNameControl in the FieldTemplates
folder:

<%@ Control Language="C#" AutoEventWireup="true"
CodeBehind="FullNameControl.ascx.cs"
Inherits="DynamicAspNetTest.DynamicData.FieldTemplates.FullNameControl" %>
<asp:Literal runat="server" ID="Literal1" Text='<%#
Eval("FirstName").ToString() + "," + Eval("LastName").ToString() %>' />

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace DynamicAspNetTest.DynamicData.FieldTemplates
{
public partial class NameControl :
System.Web.DynamicData.FieldTemplateUserControl
{
public override Control DataControl
{
get
{
return Literal1;
}
}
}
}

Then edit your partial class:

[MetadataType(typeof(PersonMetadata))]
public partial class Person
{

}

public class PersonMetadata
{
//Show FullName in the FirstName column
[UIHint("FullNameControl")]
[DisplayName("FullName")]
public string FirstName { get; set; }

//Hide LastName
[ScaffoldColumn(false)]
public string LastName { get; set; }


}

Please have a try and feel free to ask if you have further questions.

Regards,
Allen Chen
Microsoft Online Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
| From: "markla" <markla@noemail.noemail>
| Subject: DynamicData pages and additional fields on an EDM model
| Date: Wed, 3 Sep 2008 02:51:54 -0400
| Lines: 1
| MIME-Version: 1.0
| Content-Type: text/plain;
| format=flowed;
| charset="iso-8859-1";
| reply-type=original
| Content-Transfer-Encoding: 7bit
| X-Priority: 3
| X-MSMail-Priority: Normal
| Importance: Normal
| X-Newsreader: Microsoft Windows Live Mail 12.0.1606
| X-MimeOLE: Produced By Microsoft MimeOLE V12.0.1606
| Message-ID: <ucyeNGZDJHA.4732@TK2MSFTNGP04.phx.gbl>
| Newsgroups:
microsoft.public.dotnet.framework.adonet,microsoft.public.dotnet.framework.a
spnet
| NNTP-Posting-Host: 12-50-98-79.att-inc.com 12.50.98.79
| Path: TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTNGP04.phx.gbl
| Xref: TK2MSFTNGHUB02.phx.gbl
microsoft.public.dotnet.framework.aspnet:75165
microsoft.public.dotnet.framework.adonet:11090
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Hi,
|
| I have an EDM model, which I'm rendering using DynamicData pages.
|
| I need to add a derived/calculated field.
|
| For example, in a "Person" entity, I have LastName and FirstName. I need
to
| add a derived field FullName (being LastName + ", " + FirstName)
|
| I have tried adding the FullName field to Person's EDM partial class, and
| set the column to be scaffolded, however I can't get FullName to display.
|
| Any tips on how to get derived fields to show in DynamicData pages?
|
| Thanks,
| +Mark
|
|


Re: DynamicData pages and additional fields on an EDM model by markla

markla
Fri Sep 05 04:48:32 CDT 2008

Thanks- unfortunately I still get the same error: "The display column
'FullName' specified for the table 'People' does not exist."

I'm using c#. Below is the code, for information. I've tried the
ScaffoldColumn attribute on the property, and in the metadata class, neither
make any difference.

Suggestions, anyone?

--->
[MetadataType(typeof(PersonMetadata))]
[ScaffoldTable(true)]
[DisplayColumn("FullName")]
[DisplayName("Person")]
public partial class Person
{
public string FullName
{
get
{
return this.LastName + ", " + this.FirstName;
}
}
}
public class PersonMetadata
{
[ScaffoldColumn(false)]
public string PersonId;

[ScaffoldColumn(true)]
public string FullName;
}
--->

"Elmer Carías" <elmer_carias@hotmail.com> wrote in message
news:#XAbGmeDJHA.4800@TK2MSFTNGP06.phx.gbl...
> - Create a partial Class of your entity
> - Add a Public ReadOnly Property for the compute column
> - Add atrtribute ScaffoldColumnAttribute(True) to the Property
>
> Atte. Elmer Carías
> DCE 4
> El Salvador , Central America
>
>
>
> "markla" <markla@noemail.noemail> escribió en el mensaje
> news:ucyeNGZDJHA.4732@TK2MSFTNGP04.phx.gbl...
>> Hi,
>>
>> I have an EDM model, which I'm rendering using DynamicData pages.
>>
>> I need to add a derived/calculated field.
>>
>> For example, in a "Person" entity, I have LastName and FirstName. I need
>> to add a derived field FullName (being LastName + ", " + FirstName)
>>
>> I have tried adding the FullName field to Person's EDM partial class, and
>> set the column to be scaffolded, however I can't get FullName to display.
>>
>> Any tips on how to get derived fields to show in DynamicData pages?
>>
>> Thanks,
>> +Mark
>
>

Re: DynamicData pages and additional fields on an EDM model by v-alchen

v-alchen
Sun Sep 07 21:07:37 CDT 2008

Hi Mark,

If I'm correct you're using my second suggestion. To do this please try
following steps:

1. Add a new Web UserControl called FullNameControl.ascx in the
FieldTemplates folder. Here's the code:
ascx:
<%@ Control Language="C#" AutoEventWireup="true"
CodeBehind="FullNameControl.ascx.cs"
Inherits="DynamicAspNetTest.DynamicData.FieldTemplates.FullNameControl" %>
<asp:Literal runat="server" ID="Literal1" Text='<%#
Eval("FirstName").ToString() + "," + Eval("LastName").ToString() %>' />

ascx.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace DynamicAspNetTest.DynamicData.FieldTemplates
{
public partial class NameControl :
System.Web.DynamicData.FieldTemplateUserControl
{
public override Control DataControl
{
get
{
return Literal1;
}
}
}
}

2. Edit the partial class:
[MetadataType(typeof(PersonMetadata))]
public partial class Person
{

}

public class PersonMetadata
{
//Show FullName in the FirstName column
[UIHint("FullNameControl")]
[DisplayName("FullName")]
public string FirstName { get; set; }

//Hide LastName
[ScaffoldColumn(false)]
public string LastName { get; set; }


}

Please note, the "FullName" only appears at [DisplayName("FullName")]. We
don't have to add a new property in the PersonMetadata calss. The idea is
to change the DisplayName of the FistName field and use a custom UI
(FullNameControl.ascx) to let it show the "FullName".

Please have a try and let me know if my code works.

Regards,
Allen Chen
Microsoft Online Support

--------------------
| From: "markla" <markla@noemail.noemail>
| References: <ucyeNGZDJHA.4732@TK2MSFTNGP04.phx.gbl>
<#XAbGmeDJHA.4800@TK2MSFTNGP06.phx.gbl>
| Subject: Re: DynamicData pages and additional fields on an EDM model
| Date: Fri, 5 Sep 2008 05:48:32 -0400
| Lines: 1
| MIME-Version: 1.0
| Content-Type: text/plain;
| format=flowed;
| charset="iso-8859-1";
| reply-type=response
| Content-Transfer-Encoding: 8bit
| X-Priority: 3
| X-MSMail-Priority: Normal
| Importance: Normal
| X-Newsreader: Microsoft Windows Live Mail 12.0.1606
| X-MimeOLE: Produced By Microsoft MimeOLE V12.0.1606
| Message-ID: <erstSyzDJHA.232@TK2MSFTNGP04.phx.gbl>
| Newsgroups:
microsoft.public.dotnet.framework.adonet,microsoft.public.dotnet.framework.a
spnet
| NNTP-Posting-Host: 12-50-98-46.att-inc.com 12.50.98.46
| Path: TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTNGP04.phx.gbl
| Xref: TK2MSFTNGHUB02.phx.gbl
microsoft.public.dotnet.framework.aspnet:75318
microsoft.public.dotnet.framework.adonet:11114
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Thanks- unfortunately I still get the same error: "The display column
| 'FullName' specified for the table 'People' does not exist."
|
| I'm using c#. Below is the code, for information. I've tried the
| ScaffoldColumn attribute on the property, and in the metadata class,
neither
| make any difference.
|
| Suggestions, anyone?
|
| --->
| [MetadataType(typeof(PersonMetadata))]
| [ScaffoldTable(true)]
| [DisplayColumn("FullName")]
| [DisplayName("Person")]
| public partial class Person
| {
| public string FullName
| {
| get
| {
| return this.LastName + ", " + this.FirstName;
| }
| }
| }
| public class PersonMetadata
| {
| [ScaffoldColumn(false)]
| public string PersonId;
|
| [ScaffoldColumn(true)]
| public string FullName;
| }
| --->
|
| "Elmer Carías" <elmer_carias@hotmail.com> wrote in message
| news:#XAbGmeDJHA.4800@TK2MSFTNGP06.phx.gbl...
| > - Create a partial Class of your entity
| > - Add a Public ReadOnly Property for the compute column
| > - Add atrtribute ScaffoldColumnAttribute(True) to the Property
| >
| > Atte. Elmer Carías
| > DCE 4
| > El Salvador , Central America
| >
| >
| >
| > "markla" <markla@noemail.noemail> escribió en el mensaje
| > news:ucyeNGZDJHA.4732@TK2MSFTNGP04.phx.gbl...
| >> Hi,
| >>
| >> I have an EDM model, which I'm rendering using DynamicData pages.
| >>
| >> I need to add a derived/calculated field.
| >>
| >> For example, in a "Person" entity, I have LastName and FirstName. I
need
| >> to add a derived field FullName (being LastName + ", " + FirstName)
| >>
| >> I have tried adding the FullName field to Person's EDM partial class,
and
| >> set the column to be scaffolded, however I can't get FullName to
display.
| >>
| >> Any tips on how to get derived fields to show in DynamicData pages?
| >>
| >> Thanks,
| >> +Mark
| >
| >
|


Re: DynamicData pages and additional fields on an EDM model by v-alchen

v-alchen
Tue Sep 09 20:28:25 CDT 2008

Hi Mark,

Have you tried my suggestion? Can my code work?

Regards,
Allen Chen
Microsoft Online Community Support
--------------------
| From: "markla" <markla@noemail.noemail>
| References: <ucyeNGZDJHA.4732@TK2MSFTNGP04.phx.gbl>
<#XAbGmeDJHA.4800@TK2MSFTNGP06.phx.gbl>
| Subject: Re: DynamicData pages and additional fields on an EDM model
| Date: Fri, 5 Sep 2008 05:48:32 -0400
| Lines: 1
| MIME-Version: 1.0
| Content-Type: text/plain;
| format=flowed;
| charset="iso-8859-1";
| reply-type=response
| Content-Transfer-Encoding: 8bit
| X-Priority: 3
| X-MSMail-Priority: Normal
| Importance: Normal
| X-Newsreader: Microsoft Windows Live Mail 12.0.1606
| X-MimeOLE: Produced By Microsoft MimeOLE V12.0.1606
| Message-ID: <erstSyzDJHA.232@TK2MSFTNGP04.phx.gbl>
| Newsgroups:
microsoft.public.dotnet.framework.adonet,microsoft.public.dotnet.framework.a
spnet
| NNTP-Posting-Host: 12-50-98-46.att-inc.com 12.50.98.46
| Path: TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTNGP04.phx.gbl
| Xref: TK2MSFTNGHUB02.phx.gbl
microsoft.public.dotnet.framework.aspnet:75318
microsoft.public.dotnet.framework.adonet:11114
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Thanks- unfortunately I still get the same error: "The display column
| 'FullName' specified for the table 'People' does not exist."
|
| I'm using c#. Below is the code, for information. I've tried the
| ScaffoldColumn attribute on the property, and in the metadata class,
neither
| make any difference.
|
| Suggestions, anyone?
|
| --->
| [MetadataType(typeof(PersonMetadata))]
| [ScaffoldTable(true)]
| [DisplayColumn("FullName")]
| [DisplayName("Person")]
| public partial class Person
| {
| public string FullName
| {
| get
| {
| return this.LastName + ", " + this.FirstName;
| }
| }
| }
| public class PersonMetadata
| {
| [ScaffoldColumn(false)]
| public string PersonId;
|
| [ScaffoldColumn(true)]
| public string FullName;
| }
| --->
|
| "Elmer Carías" <elmer_carias@hotmail.com> wrote in message
| news:#XAbGmeDJHA.4800@TK2MSFTNGP06.phx.gbl...
| > - Create a partial Class of your entity
| > - Add a Public ReadOnly Property for the compute column
| > - Add atrtribute ScaffoldColumnAttribute(True) to the Property
| >
| > Atte. Elmer Carías
| > DCE 4
| > El Salvador , Central America
| >
| >
| >
| > "markla" <markla@noemail.noemail> escribió en el mensaje
| > news:ucyeNGZDJHA.4732@TK2MSFTNGP04.phx.gbl...
| >> Hi,
| >>
| >> I have an EDM model, which I'm rendering using DynamicData pages.
| >>
| >> I need to add a derived/calculated field.
| >>
| >> For example, in a "Person" entity, I have LastName and FirstName. I
need
| >> to add a derived field FullName (being LastName + ", " + FirstName)
| >>
| >> I have tried adding the FullName field to Person's EDM partial class,
and
| >> set the column to be scaffolded, however I can't get FullName to
display.
| >>
| >> Any tips on how to get derived fields to show in DynamicData pages?
| >>
| >> Thanks,
| >> +Mark
| >
| >
|


Re: DynamicData pages and additional fields on an EDM model by markla

markla
Tue Sep 09 20:31:10 CDT 2008

Thanks- the code works for displaying a "person".

However, the other half of the problem, is how I display the fullname in a
related table. Let's say the person has an Entry into a competition, so for
an Entry there is a PersonId, a CompId, and a TicketNumber field. When I
display a list of entries for a competition, I need to display the fullname,
as a combination of both FirstName and LastName.

I can't see an obvious way to modify the ForeignKey.ascx class to lookup two
fields from the parent entity- it only gets the "GetDisplayString()"- which
is returned based on the [DisplayColumn()] attribute of the Person class-
and I can only specify individual fields in DisplayColumn().

How can I show the FullName for each related parent person in a list?

Thanks,
+Mark

"Allen Chen [MSFT]" <v-alchen@online.microsoft.com> wrote in message
news:ClluteVEJHA.6100@TK2MSFTNGHUB02.phx.gbl...
> Hi Mark,
>
> If I'm correct you're using my second suggestion. To do this please try
> following steps:
>
> 1. Add a new Web UserControl called FullNameControl.ascx in the
> FieldTemplates folder. Here's the code:
> ascx:
> <%@ Control Language="C#" AutoEventWireup="true"
> CodeBehind="FullNameControl.ascx.cs"
> Inherits="DynamicAspNetTest.DynamicData.FieldTemplates.FullNameControl" %>
> <asp:Literal runat="server" ID="Literal1" Text='<%#
> Eval("FirstName").ToString() + "," + Eval("LastName").ToString() %>' />
>
> ascx.cs:
>
> using System;
> using System.Collections.Generic;
> using System.Linq;
> using System.Web;
> using System.Web.UI;
> using System.Web.UI.WebControls;
>
> namespace DynamicAspNetTest.DynamicData.FieldTemplates
> {
> public partial class NameControl :
> System.Web.DynamicData.FieldTemplateUserControl
> {
> public override Control DataControl
> {
> get
> {
> return Literal1;
> }
> }
> }
> }
>
> 2. Edit the partial class:
> [MetadataType(typeof(PersonMetadata))]
> public partial class Person
> {
>
> }
>
> public class PersonMetadata
> {
> //Show FullName in the FirstName column
> [UIHint("FullNameControl")]
> [DisplayName("FullName")]
> public string FirstName { get; set; }
>
> //Hide LastName
> [ScaffoldColumn(false)]
> public string LastName { get; set; }
>
>
> }
>
> Please note, the "FullName" only appears at [DisplayName("FullName")]. We
> don't have to add a new property in the PersonMetadata calss. The idea is
> to change the DisplayName of the FistName field and use a custom UI
> (FullNameControl.ascx) to let it show the "FullName".
>
> Please have a try and let me know if my code works.
>
> Regards,
> Allen Chen
> Microsoft Online Support
>
> --------------------
> | From: "markla" <markla@noemail.noemail>
> | References: <ucyeNGZDJHA.4732@TK2MSFTNGP04.phx.gbl>
> <#XAbGmeDJHA.4800@TK2MSFTNGP06.phx.gbl>
> | Subject: Re: DynamicData pages and additional fields on an EDM model
> | Date: Fri, 5 Sep 2008 05:48:32 -0400
> | Lines: 1
> | MIME-Version: 1.0
> | Content-Type: text/plain;
> | format=flowed;
> | charset="iso-8859-1";
> | reply-type=response
> | Content-Transfer-Encoding: 8bit
> | X-Priority: 3
> | X-MSMail-Priority: Normal
> | Importance: Normal
> | X-Newsreader: Microsoft Windows Live Mail 12.0.1606
> | X-MimeOLE: Produced By Microsoft MimeOLE V12.0.1606
> | Message-ID: <erstSyzDJHA.232@TK2MSFTNGP04.phx.gbl>
> | Newsgroups:
> microsoft.public.dotnet.framework.adonet,microsoft.public.dotnet.framework.a
> spnet
> | NNTP-Posting-Host: 12-50-98-46.att-inc.com 12.50.98.46
> | Path: TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTNGP04.phx.gbl
> | Xref: TK2MSFTNGHUB02.phx.gbl
> microsoft.public.dotnet.framework.aspnet:75318
> microsoft.public.dotnet.framework.adonet:11114
> | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
> |
> | Thanks- unfortunately I still get the same error: "The display column
> | 'FullName' specified for the table 'People' does not exist."
> |
> | I'm using c#. Below is the code, for information. I've tried the
> | ScaffoldColumn attribute on the property, and in the metadata class,
> neither
> | make any difference.
> |
> | Suggestions, anyone?
> |
> | --->
> | [MetadataType(typeof(PersonMetadata))]
> | [ScaffoldTable(true)]
> | [DisplayColumn("FullName")]
> | [DisplayName("Person")]
> | public partial class Person
> | {
> | public string FullName
> | {
> | get
> | {
> | return this.LastName + ", " + this.FirstName;
> | }
> | }
> | }
> | public class PersonMetadata
> | {
> | [ScaffoldColumn(false)]
> | public string PersonId;
> |
> | [ScaffoldColumn(true)]
> | public string FullName;
> | }
> | --->
> |
> | "Elmer Carías" <elmer_carias@hotmail.com> wrote in message
> | news:#XAbGmeDJHA.4800@TK2MSFTNGP06.phx.gbl...
> | > - Create a partial Class of your entity
> | > - Add a Public ReadOnly Property for the compute column
> | > - Add atrtribute ScaffoldColumnAttribute(True) to the Property
> | >
> | > Atte. Elmer Carías
> | > DCE 4
> | > El Salvador , Central America
> | >
> | >
> | >
> | > "markla" <markla@noemail.noemail> escribió en el mensaje
> | > news:ucyeNGZDJHA.4732@TK2MSFTNGP04.phx.gbl...
> | >> Hi,
> | >>
> | >> I have an EDM model, which I'm rendering using DynamicData pages.
> | >>
> | >> I need to add a derived/calculated field.
> | >>
> | >> For example, in a "Person" entity, I have LastName and FirstName. I
> need
> | >> to add a derived field FullName (being LastName + ", " + FirstName)
> | >>
> | >> I have tried adding the FullName field to Person's EDM partial class,
> and
> | >> set the column to be scaffolded, however I can't get FullName to
> display.
> | >>
> | >> Any tips on how to get derived fields to show in DynamicData pages?
> | >>
> | >> Thanks,
> | >> +Mark
> | >
> | >
> |
>

Re: DynamicData pages and additional fields on an EDM model by v-alchen

v-alchen
Wed Sep 10 02:35:05 CDT 2008

Hi Mark,
We can use a similar approach to achieve this for the Competition table.

1. Firstly add a Web User Control MyForeignKey.ascx in the FieldTemplates
folder:

ascx:
<%@ Control Language="C#" AutoEventWireup="true"
CodeBehind="MyForeignKey.ascx.cs"
Inherits="DynamicAspNetTest.DynamicData.FieldTemplates.MyForeignKey" %>
<asp:Literal runat="server" ID="Literal1" Text="<%# GetDisplayString() %>"/>

ascx.cs:
public partial class MyForeignKey :
System.Web.DynamicData.FieldTemplateUserControl
{
public override Control DataControl
{
get
{

return Literal1;
}
}
protected string GetDisplayString()
{
Person p=(Person)FieldValue;
string fullname= p.FirstName + "," + p.LastName;
return fullname;
}
}

2. Edit the partial class:
[MetadataType(typeof(CompetitionHeaderMetadata))]
public partial class Competition
{

}
public class CompetitionHeaderMetadata
{

[UIHint("MyForeignKey")]
public Customer Customer { get; set; }

}

Please try it and let me know if it works.

Thanks,
Allen Chen
Microsoft Online Support

--------------------
| From: "markla" <markla@noemail.noemail>
| References: <ucyeNGZDJHA.4732@TK2MSFTNGP04.phx.gbl>
<#XAbGmeDJHA.4800@TK2MSFTNGP06.phx.gbl>
<erstSyzDJHA.232@TK2MSFTNGP04.phx.gbl>
<ClluteVEJHA.6100@TK2MSFTNGHUB02.phx.gbl>
| Subject: Re: DynamicData pages and additional fields on an EDM model
| Date: Wed, 10 Sep 2008 11:31:10 +1000
| Lines: 4
| MIME-Version: 1.0
| Content-Type: text/plain;
| format=flowed;
| charset="iso-8859-1";
| reply-type=original
| Content-Transfer-Encoding: 8bit
| X-Priority: 3
| X-MSMail-Priority: Normal
| Importance: Normal
| X-Newsreader: Microsoft Windows Live Mail 12.0.1606
| X-MimeOLE: Produced By Microsoft MimeOLE V12.0.1606
| Message-ID: <#tastTuEJHA.4960@TK2MSFTNGP05.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: 203-214-145-181.perm.iinet.net.au 203.214.145.181
| Path: TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTNGP05.phx.gbl
| Xref: TK2MSFTNGHUB02.phx.gbl
microsoft.public.dotnet.framework.aspnet:75681
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Thanks- the code works for displaying a "person".
|
| However, the other half of the problem, is how I display the fullname in
a
| related table. Let's say the person has an Entry into a competition, so
for
| an Entry there is a PersonId, a CompId, and a TicketNumber field. When I
| display a list of entries for a competition, I need to display the
fullname,
| as a combination of both FirstName and LastName.
|
| I can't see an obvious way to modify the ForeignKey.ascx class to lookup
two
| fields from the parent entity- it only gets the "GetDisplayString()"-
which
| is returned based on the [DisplayColumn()] attribute of the Person class-
| and I can only specify individual fields in DisplayColumn().
|
| How can I show the FullName for each related parent person in a list?
|
| Thanks,
| +Mark
|
| "Allen Chen [MSFT]" <v-alchen@online.microsoft.com> wrote in message
| news:ClluteVEJHA.6100@TK2MSFTNGHUB02.phx.gbl...
| > Hi Mark,
| >
| > If I'm correct you're using my second suggestion. To do this please try
| > following steps:
| >
| > 1. Add a new Web UserControl called FullNameControl.ascx in the
| > FieldTemplates folder. Here's the code:
| > ascx:
| > <%@ Control Language="C#" AutoEventWireup="true"
| > CodeBehind="FullNameControl.ascx.cs"
| > Inherits="DynamicAspNetTest.DynamicData.FieldTemplates.FullNameControl"
%>
| > <asp:Literal runat="server" ID="Literal1" Text='<%#
| > Eval("FirstName").ToString() + "," + Eval("LastName").ToString() %>' />
| >
| > ascx.cs:
| >
| > using System;
| > using System.Collections.Generic;
| > using System.Linq;
| > using System.Web;
| > using System.Web.UI;
| > using System.Web.UI.WebControls;
| >
| > namespace DynamicAspNetTest.DynamicData.FieldTemplates
| > {
| > public partial class NameControl :
| > System.Web.DynamicData.FieldTemplateUserControl
| > {
| > public override Control DataControl
| > {
| > get
| > {
| > return Literal1;
| > }
| > }
| > }
| > }
| >
| > 2. Edit the partial class:
| > [MetadataType(typeof(PersonMetadata))]
| > public partial class Person
| > {
| >
| > }
| >
| > public class PersonMetadata
| > {
| > //Show FullName in the FirstName column
| > [UIHint("FullNameControl")]
| > [DisplayName("FullName")]
| > public string FirstName { get; set; }
| >
| > //Hide LastName
| > [ScaffoldColumn(false)]
| > public string LastName { get; set; }
| >
| >
| > }
| >
| > Please note, the "FullName" only appears at [DisplayName("FullName")].
We
| > don't have to add a new property in the PersonMetadata calss. The idea
is
| > to change the DisplayName of the FistName field and use a custom UI
| > (FullNameControl.ascx) to let it show the "FullName".
| >
| > Please have a try and let me know if my code works.
| >
| > Regards,
| > Allen Chen
| > Microsoft Online Support
| >
| > --------------------
| > | From: "markla" <markla@noemail.noemail>
| > | References: <ucyeNGZDJHA.4732@TK2MSFTNGP04.phx.gbl>
| > <#XAbGmeDJHA.4800@TK2MSFTNGP06.phx.gbl>
| > | Subject: Re: DynamicData pages and additional fields on an EDM model
| > | Date: Fri, 5 Sep 2008 05:48:32 -0400
| > | Lines: 1
| > | MIME-Version: 1.0
| > | Content-Type: text/plain;
| > | format=flowed;
| > | charset="iso-8859-1";
| > | reply-type=response
| > | Content-Transfer-Encoding: 8bit
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | Importance: Normal
| > | X-Newsreader: Microsoft Windows Live Mail 12.0.1606
| > | X-MimeOLE: Produced By Microsoft MimeOLE V12.0.1606
| > | Message-ID: <erstSyzDJHA.232@TK2MSFTNGP04.phx.gbl>
| > | Newsgroups:
| >
microsoft.public.dotnet.framework.adonet,microsoft.public.dotnet.framework.a
| > spnet
| > | NNTP-Posting-Host: 12-50-98-46.att-inc.com 12.50.98.46
| > | Path: TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTNGP04.phx.gbl
| > | Xref: TK2MSFTNGHUB02.phx.gbl
| > microsoft.public.dotnet.framework.aspnet:75318
| > microsoft.public.dotnet.framework.adonet:11114
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > |
| > | Thanks- unfortunately I still get the same error: "The display column
| > | 'FullName' specified for the table 'People' does not exist."
| > |
| > | I'm using c#. Below is the code, for information. I've tried the
| > | ScaffoldColumn attribute on the property, and in the metadata class,
| > neither
| > | make any difference.
| > |
| > | Suggestions, anyone?
| > |
| > | --->
| > | [MetadataType(typeof(PersonMetadata))]
| > | [ScaffoldTable(true)]
| > | [DisplayColumn("FullName")]
| > | [DisplayName("Person")]
| > | public partial class Person
| > | {
| > | public string FullName
| > | {
| > | get
| > | {
| > | return this.LastName + ", " + this.FirstName;
| > | }
| > | }
| > | }
| > | public class PersonMetadata
| > | {
| > | [ScaffoldColumn(false)]
| > | public string PersonId;
| > |
| > | [ScaffoldColumn(true)]
| > | public string FullName;
| > | }
| > | --->
| > |
| > | "Elmer Carías" <elmer_carias@hotmail.com> wrote in message
| > | news:#XAbGmeDJHA.4800@TK2MSFTNGP06.phx.gbl...
| > | > - Create a partial Class of your entity
| > | > - Add a Public ReadOnly Property for the compute column
| > | > - Add atrtribute ScaffoldColumnAttribute(True) to the Property
| > | >
| > | > Atte. Elmer Carías
| > | > DCE 4
| > | > El Salvador , Central America
| > | >
| > | >
| > | >
| > | > "markla" <markla@noemail.noemail> escribió en el mensaje
| > | > news:ucyeNGZDJHA.4732@TK2MSFTNGP04.phx.gbl...
| > | >> Hi,
| > | >>
| > | >> I have an EDM model, which I'm rendering using DynamicData pages.
| > | >>
| > | >> I need to add a derived/calculated field.
| > | >>
| > | >> For example, in a "Person" entity, I have LastName and FirstName. I
| > need
| > | >> to add a derived field FullName (being LastName + ", " + FirstName)
| > | >>
| > | >> I have tried adding the FullName field to Person's EDM partial
class,
| > and
| > | >> set the column to be scaffolded, however I can't get FullName to
| > display.
| > | >>
| > | >> Any tips on how to get derived fields to show in DynamicData pages?
| > | >>
| > | >> Thanks,
| > | >> +Mark
| > | >
| > | >
| > |
| >
|


Re: DynamicData pages and additional fields on an EDM model by markla

markla
Sat Sep 13 07:51:57 CDT 2008

Thanks Allen- it works as expected.

Much appreciated.

+Mark


"Allen Chen [MSFT]" <v-alchen@online.microsoft.com> wrote in message
news:81IZBfxEJHA.6100@TK2MSFTNGHUB02.phx.gbl...
> Hi Mark,
> We can use a similar approach to achieve this for the Competition table.
>
> 1. Firstly add a Web User Control MyForeignKey.ascx in the FieldTemplates
> folder:
>
> ascx:
> <%@ Control Language="C#" AutoEventWireup="true"
> CodeBehind="MyForeignKey.ascx.cs"
> Inherits="DynamicAspNetTest.DynamicData.FieldTemplates.MyForeignKey" %>
> <asp:Literal runat="server" ID="Literal1" Text="<%# GetDisplayString()
> %>"/>
>
> ascx.cs:
> public partial class MyForeignKey :
> System.Web.DynamicData.FieldTemplateUserControl
> {
> public override Control DataControl
> {
> get
> {
>
> return Literal1;
> }
> }
> protected string GetDisplayString()
> {
> Person p=(Person)FieldValue;
> string fullname= p.FirstName + "," + p.LastName;
> return fullname;
> }
> }
>
> 2. Edit the partial class:
> [MetadataType(typeof(CompetitionHeaderMetadata))]
> public partial class Competition
> {
>
> }
> public class CompetitionHeaderMetadata
> {
>
> [UIHint("MyForeignKey")]
> public Customer Customer { get; set; }
>
> }
>
> Please try it and let me know if it works.
>
> Thanks,
> Allen Chen
> Microsoft Online Support
>
> --------------------
> | From: "markla" <markla@noemail.noemail>
> | References: <ucyeNGZDJHA.4732@TK2MSFTNGP04.phx.gbl>
> <#XAbGmeDJHA.4800@TK2MSFTNGP06.phx.gbl>
> <erstSyzDJHA.232@TK2MSFTNGP04.phx.gbl>
> <ClluteVEJHA.6100@TK2MSFTNGHUB02.phx.gbl>
> | Subject: Re: DynamicData pages and additional fields on an EDM model
> | Date: Wed, 10 Sep 2008 11:31:10 +1000
> | Lines: 4
> | MIME-Version: 1.0
> | Content-Type: text/plain;
> | format=flowed;
> | charset="iso-8859-1";
> | reply-type=original
> | Content-Transfer-Encoding: 8bit
> | X-Priority: 3
> | X-MSMail-Priority: Normal
> | Importance: Normal
> | X-Newsreader: Microsoft Windows Live Mail 12.0.1606
> | X-MimeOLE: Produced By Microsoft MimeOLE V12.0.1606
> | Message-ID: <#tastTuEJHA.4960@TK2MSFTNGP05.phx.gbl>
> | Newsgroups: microsoft.public.dotnet.framework.aspnet
> | NNTP-Posting-Host: 203-214-145-181.perm.iinet.net.au 203.214.145.181
> | Path: TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTNGP05.phx.gbl
> | Xref: TK2MSFTNGHUB02.phx.gbl
> microsoft.public.dotnet.framework.aspnet:75681
> | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
> |
> | Thanks- the code works for displaying a "person".
> |
> | However, the other half of the problem, is how I display the fullname in
> a
> | related table. Let's say the person has an Entry into a competition, so
> for
> | an Entry there is a PersonId, a CompId, and a TicketNumber field. When I
> | display a list of entries for a competition, I need to display the
> fullname,
> | as a combination of both FirstName and LastName.
> |
> | I can't see an obvious way to modify the ForeignKey.ascx class to lookup
> two
> | fields from the parent entity- it only gets the "GetDisplayString()"-
> which
> | is returned based on the [DisplayColumn()] attribute of the Person
> class-
> | and I can only specify individual fields in DisplayColumn().
> |
> | How can I show the FullName for each related parent person in a list?
> |
> | Thanks,
> | +Mark
> |
> | "Allen Chen [MSFT]" <v-alchen@online.microsoft.com> wrote in message
> | news:ClluteVEJHA.6100@TK2MSFTNGHUB02.phx.gbl...
> | > Hi Mark,
> | >
> | > If I'm correct you're using my second suggestion. To do this please
> try
> | > following steps:
> | >
> | > 1. Add a new Web UserControl called FullNameControl.ascx in the
> | > FieldTemplates folder. Here's the code:
> | > ascx:
> | > <%@ Control Language="C#" AutoEventWireup="true"
> | > CodeBehind="FullNameControl.ascx.cs"
> | >
> Inherits="DynamicAspNetTest.DynamicData.FieldTemplates.FullNameControl"
> %>
> | > <asp:Literal runat="server" ID="Literal1" Text='<%#
> | > Eval("FirstName").ToString() + "," + Eval("LastName").ToString() %>'
> />
> | >
> | > ascx.cs:
> | >
> | > using System;
> | > using System.Collections.Generic;
> | > using System.Linq;
> | > using System.Web;
> | > using System.Web.UI;
> | > using System.Web.UI.WebControls;
> | >
> | > namespace DynamicAspNetTest.DynamicData.FieldTemplates
> | > {
> | > public partial class NameControl :
> | > System.Web.DynamicData.FieldTemplateUserControl
> | > {
> | > public override Control DataControl
> | > {
> | > get
> | > {
> | > return Literal1;
> | > }
> | > }
> | > }
> | > }
> | >
> | > 2. Edit the partial class:
> | > [MetadataType(typeof(PersonMetadata))]
> | > public partial class Person
> | > {
> | >
> | > }
> | >
> | > public class PersonMetadata
> | > {
> | > //Show FullName in the FirstName column
> | > [UIHint("FullNameControl")]
> | > [DisplayName("FullName")]
> | > public string FirstName { get; set; }
> | >
> | > //Hide LastName
> | > [ScaffoldColumn(false)]
> | > public string LastName { get; set; }
> | >
> | >
> | > }
> | >
> | > Please note, the "FullName" only appears at [DisplayName("FullName")].
> We
> | > don't have to add a new property in the PersonMetadata calss. The
> idea
> is
> | > to change the DisplayName of the FistName field and use a custom UI
> | > (FullNameControl.ascx) to let it show the "FullName".
> | >
> | > Please have a try and let me know if my code works.
> | >
> | > Regards,
> | > Allen Chen
> | > Microsoft Online Support
> | >
> | > --------------------
> | > | From: "markla" <markla@noemail.noemail>
> | > | References: <ucyeNGZDJHA.4732@TK2MSFTNGP04.phx.gbl>
> | > <#XAbGmeDJHA.4800@TK2MSFTNGP06.phx.gbl>
> | > | Subject: Re: DynamicData pages and additional fields on an EDM model
> | > | Date: Fri, 5 Sep 2008 05:48:32 -0400
> | > | Lines: 1
> | > | MIME-Version: 1.0
> | > | Content-Type: text/plain;
> | > | format=flowed;
> | > | charset="iso-8859-1";
> | > | reply-type=response
> | > | Content-Transfer-Encoding: 8bit
> | > | X-Priority: 3
> | > | X-MSMail-Priority: Normal
> | > | Importance: Normal
> | > | X-Newsreader: Microsoft Windows Live Mail 12.0.1606
> | > | X-MimeOLE: Produced By Microsoft MimeOLE V12.0.1606
> | > | Message-ID: <erstSyzDJHA.232@TK2MSFTNGP04.phx.gbl>
> | > | Newsgroups:
> | >
> microsoft.public.dotnet.framework.adonet,microsoft.public.dotnet.framework.a
> | > spnet
> | > | NNTP-Posting-Host: 12-50-98-46.att-inc.com 12.50.98.46
> | > | Path:
> TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTNGP04.phx.gbl
> | > | Xref: TK2MSFTNGHUB02.phx.gbl
> | > microsoft.public.dotnet.framework.aspnet:75318
> | > microsoft.public.dotnet.framework.adonet:11114
> | > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
> | > |
> | > | Thanks- unfortunately I still get the same error: "The display
> column
> | > | 'FullName' specified for the table 'People' does not exist."
> | > |
> | > | I'm using c#. Below is the code, for information. I've tried the
> | > | ScaffoldColumn attribute on the property, and in the metadata class,
> | > neither
> | > | make any difference.
> | > |
> | > | Suggestions, anyone?
> | > |
> | > | --->
> | > | [MetadataType(typeof(PersonMetadata))]
> | > | [ScaffoldTable(true)]
> | > | [DisplayColumn("FullName")]
> | > | [DisplayName("Person")]
> | > | public partial class Person
> | > | {
> | > | public string FullName
> | > | {
> | > | get
> | > | {
> | > | return this.LastName + ", " + this.FirstName;
> | > | }
> | > | }
> | > | }
> | > | public class PersonMetadata
> | > | {
> | > | [ScaffoldColumn(false)]
> | > | public string PersonId;
> | > |
> | > | [ScaffoldColumn(true)]
> | > | public string FullName;
> | > | }
> | > | --->
> | > |
> | > | "Elmer Carías" <elmer_carias@hotmail.com> wrote in message
> | > | news:#XAbGmeDJHA.4800@TK2MSFTNGP06.phx.gbl...
> | > | > - Create a partial Class of your entity
> | > | > - Add a Public ReadOnly Property for the compute column
> | > | > - Add atrtribute ScaffoldColumnAttribute(True) to the Property
> | > | >
> | > | > Atte. Elmer Carías
> | > | > DCE 4
> | > | > El Salvador , Central America
> | > | >
> | > | >
> | > | >
> | > | > "markla" <markla@noemail.noemail> escribió en el mensaje
> | > | > news:ucyeNGZDJHA.4732@TK2MSFTNGP04.phx.gbl...
> | > | >> Hi,
> | > | >>
> | > | >> I have an EDM model, which I'm rendering using DynamicData pages.
> | > | >>
> | > | >> I need to add a derived/calculated field.
> | > | >>
> | > | >> For example, in a "Person" entity, I have LastName and FirstName.
> I
> | > need
> | > | >> to add a derived field FullName (being LastName + ", " +
> FirstName)
> | > | >>
> | > | >> I have tried adding the FullName field to Person's EDM partial
> class,
> | > and
> | > | >> set the column to be scaffolded, however I can't get FullName to
> | > display.
> | > | >>
> | > | >> Any tips on how to get derived fields to show in DynamicData
> pages?
> | > | >>
> | > | >> Thanks,
> | > | >> +Mark
> | > | >
> | > | >
> | > |
> | >
> |
>

Re: DynamicData pages and additional fields on an EDM model by v-alchen

v-alchen
Thu Sep 11 20:24:30 CDT 2008

Hi Mark,
Can my code work?

Regards,
Allen Chen
Microsoft Online Support
--------------------
| From: "markla" <markla@noemail.noemail>
| References: <ucyeNGZDJHA.4732@TK2MSFTNGP04.phx.gbl>
<#XAbGmeDJHA.4800@TK2MSFTNGP06.phx.gbl>
<erstSyzDJHA.232@TK2MSFTNGP04.phx.gbl>
<ClluteVEJHA.6100@TK2MSFTNGHUB02.phx.gbl>
| Subject: Re: DynamicData pages and additional fields on an EDM model
| Date: Wed, 10 Sep 2008 11:31:10 +1000
| Lines: 4
| MIME-Version: 1.0
| Content-Type: text/plain;
| format=flowed;
| charset="iso-8859-1";
| reply-type=original
| Content-Transfer-Encoding: 8bit
| X-Priority: 3
| X-MSMail-Priority: Normal
| Importance: Normal
| X-Newsreader: Microsoft Windows Live Mail 12.0.1606
| X-MimeOLE: Produced By Microsoft MimeOLE V12.0.1606
| Message-ID: <#tastTuEJHA.4960@TK2MSFTNGP05.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: 203-214-145-181.perm.iinet.net.au 203.214.145.181
| Path: TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTNGP05.phx.gbl
| Xref: TK2MSFTNGHUB02.phx.gbl
microsoft.public.dotnet.framework.aspnet:75681
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Thanks- the code works for displaying a "person".
|
| However, the other half of the problem, is how I display the fullname in
a
| related table. Let's say the person has an Entry into a competition, so
for
| an Entry there is a PersonId, a CompId, and a TicketNumber field. When I
| display a list of entries for a competition, I need to display the
fullname,
| as a combination of both FirstName and LastName.
|
| I can't see an obvious way to modify the ForeignKey.ascx class to lookup
two
| fields from the parent entity- it only gets the "GetDisplayString()"-
which
| is returned based on the [DisplayColumn()] attribute of the Person class-
| and I can only specify individual fields in DisplayColumn().
|
| How can I show the FullName for each related parent person in a list?
|
| Thanks,
| +Mark
|
| "Allen Chen [MSFT]" <v-alchen@online.microsoft.com> wrote in message
| news:ClluteVEJHA.6100@TK2MSFTNGHUB02.phx.gbl...
| > Hi Mark,
| >
| > If I'm correct you're using my second suggestion. To do this please try
| > following steps:
| >
| > 1. Add a new Web UserControl called FullNameControl.ascx in the
| > FieldTemplates folder. Here's the code:
| > ascx:
| > <%@ Control Language="C#" AutoEventWireup="true"
| > CodeBehind="FullNameControl.ascx.cs"
| > Inherits="DynamicAspNetTest.DynamicData.FieldTemplates.FullNameControl"
%>
| > <asp:Literal runat="server" ID="Literal1" Text='<%#
| > Eval("FirstName").ToString() + "," + Eval("LastName").ToString() %>' />
| >
| > ascx.cs:
| >
| > using System;
| > using System.Collections.Generic;
| > using System.Linq;
| > using System.Web;
| > using System.Web.UI;
| > using System.Web.UI.WebControls;
| >
| > namespace DynamicAspNetTest.DynamicData.FieldTemplates
| > {
| > public partial class NameControl :
| > System.Web.DynamicData.FieldTemplateUserControl
| > {
| > public override Control DataControl
| > {
| > get
| > {
| > return Literal1;
| > }
| > }
| > }
| > }
| >
| > 2. Edit the partial class:
| > [MetadataType(typeof(PersonMetadata))]
| > public partial class Person
| > {
| >
| > }
| >
| > public class PersonMetadata
| > {
| > //Show FullName in the FirstName column
| > [UIHint("FullNameControl")]
| > [DisplayName("FullName")]
| > public string FirstName { get; set; }
| >
| > //Hide LastName
| > [ScaffoldColumn(false)]
| > public string LastName { get; set; }
| >
| >
| > }
| >
| > Please note, the "FullName" only appears at [DisplayName("FullName")].
We
| > don't have to add a new property in the PersonMetadata calss. The idea
is
| > to change the DisplayName of the FistName field and use a custom UI
| > (FullNameControl.ascx) to let it show the "FullName".
| >
| > Please have a try and let me know if my code works.
| >
| > Regards,
| > Allen Chen
| > Microsoft Online Support
| >
| > --------------------
| > | From: "markla" <markla@noemail.noemail>
| > | References: <ucyeNGZDJHA.4732@TK2MSFTNGP04.phx.gbl>
| > <#XAbGmeDJHA.4800@TK2MSFTNGP06.phx.gbl>
| > | Subject: Re: DynamicData pages and additional fields on an EDM model
| > | Date: Fri, 5 Sep 2008 05:48:32 -0400
| > | Lines: 1
| > | MIME-Version: 1.0
| > | Content-Type: text/plain;
| > | format=flowed;
| > | charset="iso-8859-1";
| > | reply-type=response
| > | Content-Transfer-Encoding: 8bit
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | Importance: Normal
| > | X-Newsreader: Microsoft Windows Live Mail 12.0.1606
| > | X-MimeOLE: Produced By Microsoft MimeOLE V12.0.1606
| > | Message-ID: <erstSyzDJHA.232@TK2MSFTNGP04.phx.gbl>
| > | Newsgroups:
| >
microsoft.public.dotnet.framework.adonet,microsoft.public.dotnet.framework.a
| > spnet
| > | NNTP-Posting-Host: 12-50-98-46.att-inc.com 12.50.98.46
| > | Path: TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTNGP04.phx.gbl
| > | Xref: TK2MSFTNGHUB02.phx.gbl
| > microsoft.public.dotnet.framework.aspnet:75318
| > microsoft.public.dotnet.framework.adonet:11114
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > |
| > | Thanks- unfortunately I still get the same error: "The display column
| > | 'FullName' specified for the table 'People' does not exist."
| > |
| > | I'm using c#. Below is the code, for information. I've tried the
| > | ScaffoldColumn attribute on the property, and in the metadata class,
| > neither
| > | make any difference.
| > |
| > | Suggestions, anyone?
| > |
| > | --->
| > | [MetadataType(typeof(PersonMetadata))]
| > | [ScaffoldTable(true)]
| > | [DisplayColumn("FullName")]
| > | [DisplayName("Person")]
| > | public partial class Person
| > | {
| > | public string FullName
| > | {
| > | get
| > | {
| > | return this.LastName + ", " + this.FirstName;
| > | }
| > | }
| > | }
| > | public class PersonMetadata
| > | {
| > | [ScaffoldColumn(false)]
| > | public string PersonId;
| > |
| > | [ScaffoldColumn(true)]
| > | public string FullName;
| > | }
| > | --->
| > |
| > | "Elmer Carías" <elmer_carias@hotmail.com> wrote in message
| > | news:#XAbGmeDJHA.4800@TK2MSFTNGP06.phx.gbl...
| > | > - Create a partial Class of your entity
| > | > - Add a Public ReadOnly Property for the compute column
| > | > - Add atrtribute ScaffoldColumnAttribute(True) to the Property
| > | >
| > | > Atte. Elmer Carías
| > | > DCE 4
| > | > El Salvador , Central America
| > | >
| > | >
| > | >
| > | > "markla" <markla@noemail.noemail> escribió en el mensaje
| > | > news:ucyeNGZDJHA.4732@TK2MSFTNGP04.phx.gbl...
| > | >> Hi,
| > | >>
| > | >> I have an EDM model, which I'm rendering using DynamicData pages.
| > | >>
| > | >> I need to add a derived/calculated field.
| > | >>
| > | >> For example, in a "Person" entity, I have LastName and FirstName. I
| > need
| > | >> to add a derived field FullName (being LastName + ", " + FirstName)
| > | >>
| > | >> I have tried adding the FullName field to Person's EDM partial
class,
| > and
| > | >> set the column to be scaffolded, however I can't get FullName to
| > display.
| > | >>
| > | >> Any tips on how to get derived fields to show in DynamicData pages?
| > | >>
| > | >> Thanks,
| > | >> +Mark
| > | >
| > | >
| > |
| >
|