locked
ScaffoldColumn(true) doesn't show column in DynamicData 3.5 project RRS feed

  • Question

  • User1621204640 posted

    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.

    Thursday, February 16, 2012 9:24 AM

Answers

  • User-330204900 posted

    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.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, February 16, 2012 11:27 AM

All replies

  • User-330204900 posted

    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.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, February 16, 2012 11:27 AM
  • User1014298547 posted

    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.

    Tuesday, December 11, 2012 10:02 AM
  • User-330204900 posted

    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.

    Tuesday, December 11, 2012 6:12 PM
  • User1014298547 posted

    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?

    Thursday, December 13, 2012 12:18 PM
  • User-330204900 posted

    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.

    Friday, December 14, 2012 8:19 AM
  • User1014298547 posted

    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.

    Wednesday, December 19, 2012 5:29 PM
  • User-330204900 posted

    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.

    Tuesday, January 1, 2013 12:49 PM
  • User1014298547 posted

    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...

    Tuesday, January 8, 2013 2:59 PM
  • User-330204900 posted

    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.

    Tuesday, January 8, 2013 3:51 PM