I believe you just need to add the scaffold column attribute in the metadata class file to false like this:
[ScaffoldColumn(false)]
public object <your column name> { get; set; }
That will do it. I have done that in every single column that I don't want to be displayed by the dynamic data application automatically. You must do this in a separate class in the App_Code folder defining it as partial.
Thanks for your contribution Carlos but the question is different: in my case "Projects" is not a column of the table Companies, the table Projects contains a FK to table Companies and for this reason is displayed in the parent table Companies as uou can
see from the screen attached.
Check my code is you want. All of the columns in BOLD (distinguished by the prefix mst and tbl ARE NOT part of my "Specs table" but foreign keys that are part of its referential integrity structure.
If I don't hide them they will appear as part of the columns of the grid which are playing a very dynamic role of the Dynamic Data architecture of allowing you visiting all tables derived/dependent of the table the grid is showing at that very precise moment.
[MetadataType(typeof(BookMetatbl_Specs))]
public partial class tbl_Specs
{
}
public class BookMetatbl_Specs
{
[DisplayFormat(DataFormatString = "{0:yyy-mm-dd}")]
public object date1 { get; set; }
[ScaffoldColumn(false)]
[DisplayFormat(DataFormatString="{0:yyy-mm-dd}")]
public object date2 { get; set; }
[ScaffoldColumn(false)]
public object tmm_code { get; set; }
[ScaffoldColumn(false)]
public object check_tmm { get; set; }
[ScaffoldColumn(false)]
public object date_tmm { get; set; }
[ScaffoldColumn(false)]
public object dummy1 { get; set; }
[ScaffoldColumn(false)]
public object dummy2 { get; set; }
[ScaffoldColumn(false)]
public object dummy3 { get; set; }
[ScaffoldColumn(false)]
public object dummy4 { get; set; }
[ScaffoldColumn(false)]
public object regkey { get; set; }
[ScaffoldColumn(false)]
public object loopback { get; set; }
[ScaffoldColumn(false)]
public object inheritance { get; set; }
[ScaffoldColumn(false)]
public object passwordkey { get; set; }
[ScaffoldColumn(false)]
public object algorithm { get; set; }
[ScaffoldColumn(false)]
public object mst_accounttypes { get; set; }
[ScaffoldColumn(false)]
public object mst_addresstypes { get; set; }
[ScaffoldColumn(false)]
public object mst_boniftypes { get; set; }
[ScaffoldColumn(false)]
public object mst_cardtypes { get; set; }
[ScaffoldColumn(false)]
public object mst_chargetypes { get; set; }
[ScaffoldColumn(false)]
public object mst_contacttypes { get; set; }
[ScaffoldColumn(false)]
public object mst_credtypes { get; set; }
[ScaffoldColumn(false)]
public object mst_custtypes { get; set; }
[ScaffoldColumn(false)]
public object mst_financialtypes { get; set; }
[ScaffoldColumn(false)]
public object mst_giros { get; set; }
[ScaffoldColumn(false)]
public object mst_incometypes { get; set; }
[ScaffoldColumn(false)]
public object mst_localtypes { get; set; }
[ScaffoldColumn(false)]
public object mst_movimtypes { get; set; }
[ScaffoldColumn(false)]
public object mst_neighbTypes { get; set; }
[ScaffoldColumn(false)]
public object mst_packageTypes { get; set; }
[ScaffoldColumn(false)]
public object mst_paymenttypes { get; set; }
[ScaffoldColumn(false)]
public object mst_plantypes { get; set; }
[ScaffoldColumn(false)]
public object mst_prodtypes { get; set; }
[ScaffoldColumn(false)]
public object mst_proveedtypes { get; set; }
[ScaffoldColumn(false)]
public object mst_streetTypes { get; set; }
[ScaffoldColumn(false)]
public object mst_transacttypes { get; set; }
[ScaffoldColumn(false)]
public object mst_types { get; set; }
[ScaffoldColumn(false)]
public object tbl_attribs { get; set; }
[ScaffoldColumn(false)]
public object tbl_countries { get; set; }
[ScaffoldColumn(false)]
public object tbl_custs { get; set; }
[ScaffoldColumn(false)]
public object tbl_cycles { get; set; }
[ScaffoldColumn(false)]
public object tbl_datas { get; set; }
[ScaffoldColumn(false)]
public object tbl_financials { get; set; }
[ScaffoldColumn(false)]
public object tbl_locals { get; set; }
[ScaffoldColumn(false)]
public object tbl_prods { get; set; }
[ScaffoldColumn(false)]
public object tbl_provs { get; set; }
[ScaffoldColumn(false)]
public object tbl_tmms { get; set; }
}
I think that this should be enough in solving your problem.
Kharot
Member
22 Points
13 Posts
Re: Conditional display of Foreign key navigation
Nov 25, 2009 10:57 AM|LINK
Many thanks Steve
now i read the articles you provide me
klca
Member
507 Points
411 Posts
Re: Conditional display of Foreign key navigation
Dec 02, 2009 05:19 AM|LINK
I will dare to give my opinion here.
I believe you just need to add the scaffold column attribute in the metadata class file to false like this:
[ScaffoldColumn(false)]
public object <your column name> { get; set; }
That will do it. I have done that in every single column that I don't want to be displayed by the dynamic data application automatically. You must do this in a separate class in the App_Code folder defining it as partial.
Carlos Porras (El Salvador)
Kharot
Member
22 Points
13 Posts
Re: Conditional display of Foreign key navigation
Dec 03, 2009 07:36 AM|LINK
Thanks for your contribution Carlos but the question is different: in my case "Projects" is not a column of the table Companies, the table Projects contains a FK to table Companies and for this reason is displayed in the parent table Companies as uou can see from the screen attached.
sjnaughton
All-Star
27308 Points
5458 Posts
MVP
Re: Conditional display of Foreign key navigation
Dec 03, 2009 09:45 PM|LINK
Ah. I see now it's the Children link that you want to disable I was comming at this from the wrong end.
Do you want to:
Dynamic Data
Always seeking an elegant solution.
Kharot
Member
22 Points
13 Posts
Re: Conditional display of Foreign key navigation
Dec 04, 2009 07:53 AM|LINK
My goal is to hide the column, maybe specifying an attribute on table Companies.
sjnaughton
All-Star
27308 Points
5458 Posts
MVP
Re: Conditional display of Foreign key navigation
Dec 04, 2009 09:18 AM|LINK
I'll work sonthing out for that is should just be a variation on my hide FK article [:D]
Dynamic Data
Always seeking an elegant solution.
Kharot
Member
22 Points
13 Posts
Re: Conditional display of Foreign key navigation
Dec 04, 2009 10:30 AM|LINK
Thanks a lot Steve
i will stay stuned, C# Bits is my DD bible

sjnaughton
All-Star
27308 Points
5458 Posts
MVP
Re: Conditional display of Foreign key navigation
Dec 04, 2009 11:35 AM|LINK
Hi Kharot, here it is Hiding Foreign Key or Children Columns Globally in Dynamic Data Have fun
[:D]
Dynamic Data Hide ForeignKey or Children Fields
Always seeking an elegant solution.
Kharot
Member
22 Points
13 Posts
Re: Conditional display of Foreign key navigation
Dec 04, 2009 03:33 PM|LINK
Wonderful!
Thank you very much Steve!!
klca
Member
507 Points
411 Posts
Re: Conditional display of Foreign key navigation
Dec 04, 2009 04:10 PM|LINK
Kharot,
Check my code is you want. All of the columns in BOLD (distinguished by the prefix mst and tbl ARE NOT part of my "Specs table" but foreign keys that are part of its referential integrity structure.
If I don't hide them they will appear as part of the columns of the grid which are playing a very dynamic role of the Dynamic Data architecture of allowing you visiting all tables derived/dependent of the table the grid is showing at that very precise moment.
[MetadataType(typeof(BookMetatbl_Specs))]
public partial class tbl_Specs
{
}
public class BookMetatbl_Specs
{
[DisplayFormat(DataFormatString = "{0:yyy-mm-dd}")]
public object date1 { get; set; }
[ScaffoldColumn(false)]
[DisplayFormat(DataFormatString="{0:yyy-mm-dd}")]
public object date2 { get; set; }
[ScaffoldColumn(false)]
public object tmm_code { get; set; }
[ScaffoldColumn(false)]
public object check_tmm { get; set; }
[ScaffoldColumn(false)]
public object date_tmm { get; set; }
[ScaffoldColumn(false)]
public object dummy1 { get; set; }
[ScaffoldColumn(false)]
public object dummy2 { get; set; }
[ScaffoldColumn(false)]
public object dummy3 { get; set; }
[ScaffoldColumn(false)]
public object dummy4 { get; set; }
[ScaffoldColumn(false)]
public object regkey { get; set; }
[ScaffoldColumn(false)]
public object loopback { get; set; }
[ScaffoldColumn(false)]
public object inheritance { get; set; }
[ScaffoldColumn(false)]
public object passwordkey { get; set; }
[ScaffoldColumn(false)]
public object algorithm { get; set; }
[ScaffoldColumn(false)]
public object mst_accounttypes { get; set; }
[ScaffoldColumn(false)]
public object mst_addresstypes { get; set; }
[ScaffoldColumn(false)]
public object mst_boniftypes { get; set; }
[ScaffoldColumn(false)]
public object mst_cardtypes { get; set; }
[ScaffoldColumn(false)]
public object mst_chargetypes { get; set; }
[ScaffoldColumn(false)]
public object mst_contacttypes { get; set; }
[ScaffoldColumn(false)]
public object mst_credtypes { get; set; }
[ScaffoldColumn(false)]
public object mst_custtypes { get; set; }
[ScaffoldColumn(false)]
public object mst_financialtypes { get; set; }
[ScaffoldColumn(false)]
public object mst_giros { get; set; }
[ScaffoldColumn(false)]
public object mst_incometypes { get; set; }
[ScaffoldColumn(false)]
public object mst_localtypes { get; set; }
[ScaffoldColumn(false)]
public object mst_movimtypes { get; set; }
[ScaffoldColumn(false)]
public object mst_neighbTypes { get; set; }
[ScaffoldColumn(false)]
public object mst_packageTypes { get; set; }
[ScaffoldColumn(false)]
public object mst_paymenttypes { get; set; }
[ScaffoldColumn(false)]
public object mst_plantypes { get; set; }
[ScaffoldColumn(false)]
public object mst_prodtypes { get; set; }
[ScaffoldColumn(false)]
public object mst_proveedtypes { get; set; }
[ScaffoldColumn(false)]
public object mst_streetTypes { get; set; }
[ScaffoldColumn(false)]
public object mst_transacttypes { get; set; }
[ScaffoldColumn(false)]
public object mst_types { get; set; }
[ScaffoldColumn(false)]
public object tbl_attribs { get; set; }
[ScaffoldColumn(false)]
public object tbl_countries { get; set; }
[ScaffoldColumn(false)]
public object tbl_custs { get; set; }
[ScaffoldColumn(false)]
public object tbl_cycles { get; set; }
[ScaffoldColumn(false)]
public object tbl_datas { get; set; }
[ScaffoldColumn(false)]
public object tbl_financials { get; set; }
[ScaffoldColumn(false)]
public object tbl_locals { get; set; }
[ScaffoldColumn(false)]
public object tbl_prods { get; set; }
[ScaffoldColumn(false)]
public object tbl_provs { get; set; }
[ScaffoldColumn(false)]
public object tbl_tmms { get; set; }
}
I think that this should be enough in solving your problem.
Thanks