In my Global.asax I have ScaffoldAllTables = true. One of my tables should show 12 columns in the List.aspx. However, it only shows 11. The missing column is not a foreign key or key of any type. It is of data type "text" in SQL. Is that why it doesn't
auto-scaffold? What do I have to do in order to show that column? Setting ScaffoldColumn(true) on that specific field in the metadata buddy class does nothing. Thanks in advance.
DD does not show colums that considered LARGE i.e. varchar(MAX) or Text or NText etc, they will however show in the Edit and Details pages.
In my case, the Text database type did not show in the Edit or Detail pages as well. The data type is set to Text in SQL Server and the property is set to Max in my entity model. Why is this happening?
I worked around this issue by setting the Data Type in SQL Server to varchar(50), which should be plenty of space for this column. Then by setting the Max Length property for the column in the Entity Model to none. To hide it in the details page, yet show
it in the List page, I used your
HideColumnIn custom attribute.
I'm using VS 2010, .NET Framework 4, Entity Framework 5.0.0, SQL Server 2005 (9.0.5000). (I'm using SQL 2005 because that's what is on our production server and there's no chance of upgrading.)
I created a completely new Dynamic Data website, using the same database as before. No metadata partial classes has been added. I double-checked the database field and verified that it is set to Text data type. I double-checked the Entity property for this
field and verified that the Max Length is set to Max.
After compiling and running the web site, the field appears in the List, Details, and Edit page. It also appears in the List part of the ListDetails page. So it's working in the Details and Edit pages. Maybe I had something set wrong before... But isn't
it NOT suppose to show in the List page out of the box since it's a large datatype?
Can you post the schema of the offending table or a table that will demonstrait the isseue and I will test and get back to you.
USE [Test]
GO
/****** Object: Table [dbo].[Test] Script Date: 12/19/2012 17:16:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Test](
[TestID] [uniqueidentifier] NOT NULL CONSTRAINT [DF_Test_TestID] DEFAULT (newid()),
[LargeField] [varchar](max) NULL,
CONSTRAINT [PK_Test] PRIMARY KEY CLUSTERED
(
[TestID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
That's a new, simple table that I created in a new database. I then generated a new Dynamic Data web site (not a Web Application) from it and the LargeField field appears on the List, Details, and Edit pages.
Hi SonnyTate, I have finally got around to testing that and I get the same result as you strange maybe they decided that all columns should show, in fact I think thay added a new feature to the Text field template that truncate the text when it gets too
long.
See my blog C# Bits | Twitter @sjnaughton Always seeking an elegant solution.
Ok so I'm not going crazy! lol The way I worked around it is by using Custom pages. While I'm a big fan of DRY (Don't Repeat Yourself), I really couldn't come up with any other solution. However, I'm open to suggestions...
outhowz42
Member
80 Points
121 Posts
ScaffoldColumn(true) doesn't show column in DynamicData 3.5 project
Feb 16, 2012 01:24 PM|LINK
In my Global.asax I have ScaffoldAllTables = true. One of my tables should show 12 columns in the List.aspx. However, it only shows 11. The missing column is not a foreign key or key of any type. It is of data type "text" in SQL. Is that why it doesn't auto-scaffold? What do I have to do in order to show that column? Setting ScaffoldColumn(true) on that specific field in the metadata buddy class does nothing. Thanks in advance.
sjnaughton
All-Star
27308 Points
5458 Posts
MVP
Re: ScaffoldColumn(true) doesn't show column in DynamicData 3.5 project
Feb 16, 2012 03:27 PM|LINK
DD does not show colums that considered LARGE i.e. varchar(MAX) or Text or NText etc, they will however show in the Edit and Details pages.
Always seeking an elegant solution.
SonnyTate
Member
24 Points
22 Posts
Re: ScaffoldColumn(true) doesn't show column in DynamicData 3.5 project
Dec 11, 2012 02:02 PM|LINK
In my case, the Text database type did not show in the Edit or Detail pages as well. The data type is set to Text in SQL Server and the property is set to Max in my entity model. Why is this happening?
I worked around this issue by setting the Data Type in SQL Server to varchar(50), which should be plenty of space for this column. Then by setting the Max Length property for the column in the Entity Model to none. To hide it in the details page, yet show it in the List page, I used your HideColumnIn custom attribute.
sjnaughton
All-Star
27308 Points
5458 Posts
MVP
Re: ScaffoldColumn(true) doesn't show column in DynamicData 3.5 project
Dec 11, 2012 10:12 PM|LINK
Hi SonnyTate, there must be somthing odd going on with your data model as this is an out of the box thing, no configuration required.
Always seeking an elegant solution.
SonnyTate
Member
24 Points
22 Posts
Re: ScaffoldColumn(true) doesn't show column in DynamicData 3.5 project
Dec 13, 2012 04:18 PM|LINK
I'm using VS 2010, .NET Framework 4, Entity Framework 5.0.0, SQL Server 2005 (9.0.5000). (I'm using SQL 2005 because that's what is on our production server and there's no chance of upgrading.)
I created a completely new Dynamic Data website, using the same database as before. No metadata partial classes has been added. I double-checked the database field and verified that it is set to Text data type. I double-checked the Entity property for this field and verified that the Max Length is set to Max.
After compiling and running the web site, the field appears in the List, Details, and Edit page. It also appears in the List part of the ListDetails page. So it's working in the Details and Edit pages. Maybe I had something set wrong before... But isn't it NOT suppose to show in the List page out of the box since it's a large datatype?
sjnaughton
All-Star
27308 Points
5458 Posts
MVP
Re: ScaffoldColumn(true) doesn't show column in DynamicData 3.5 project
Dec 14, 2012 12:19 PM|LINK
Can you post the schema of the offending table or a table that will demonstrait the isseue and I will test and get back to you.
Always seeking an elegant solution.
SonnyTate
Member
24 Points
22 Posts
Re: ScaffoldColumn(true) doesn't show column in DynamicData 3.5 project
Dec 19, 2012 09:29 PM|LINK
That's a new, simple table that I created in a new database. I then generated a new Dynamic Data web site (not a Web Application) from it and the LargeField field appears on the List, Details, and Edit pages.
sjnaughton
All-Star
27308 Points
5458 Posts
MVP
Re: ScaffoldColumn(true) doesn't show column in DynamicData 3.5 project
Jan 01, 2013 04:49 PM|LINK
Hi SonnyTate, I have finally got around to testing that and I get the same result as you strange maybe they decided that all columns should show, in fact I think thay added a new feature to the Text field template that truncate the text when it gets too long.
Always seeking an elegant solution.
SonnyTate
Member
24 Points
22 Posts
Re: ScaffoldColumn(true) doesn't show column in DynamicData 3.5 project
Jan 08, 2013 06:59 PM|LINK
Ok so I'm not going crazy! lol The way I worked around it is by using Custom pages. While I'm a big fan of DRY (Don't Repeat Yourself), I really couldn't come up with any other solution. However, I'm open to suggestions...
sjnaughton
All-Star
27308 Points
5458 Posts
MVP
Re: ScaffoldColumn(true) doesn't show column in DynamicData 3.5 project
Jan 08, 2013 07:51 PM|LINK
Two ways use a custom metamodel like mine here A New Way To Do Column Generation in Dynamic Data ... or you could use an custom field generator like this DynamicData - Generate Columns/Rows (using IAutoFi...
I usually use the first option now.
Always seeking an elegant solution.