nvarchar(max) Columns are not displayed

Last post 07-01-2009 2:21 PM by ricka6. 8 replies.

Sort Posts:

  • nvarchar(max) Columns are not displayed

    05-24-2009, 2:17 PM
    • Member
      46 point Member
    • orimaspnet
    • Member since 06-04-2008, 9:07 AM
    • Posts 94

     Hi,

     i am using nvarchar(max) in my sql 2005 database.
    These Columns are not displayed in my dynamic data website.

    any idea

    Thanks

  • Re: nvarchar(max) Columns are not displayed

    05-24-2009, 4:31 PM
    Answer
    • Star
      12,328 point Star
    • sjnaughton
    • Member since 04-29-2008, 5:11 PM
    • Newton-le-Willows, Merseyside, UK
    • Posts 2,567
    • TrustedFriends-MVPs

    I would use UIHint to choose the Text field.

    Steve Big Smile

    Always seeking an elegant solution.
    [Oh! If olny I colud tpye!]
    c# Bits blog
    Oh, and don't forget to mark as answer any posts that help you Big Smile
    Filed under:
  • Re: nvarchar(max) Columns are not displayed

    05-25-2009, 7:26 AM
    • Member
      46 point Member
    • orimaspnet
    • Member since 06-04-2008, 9:07 AM
    • Posts 94

    My Code in UserLogMetadata Class

         <UIHint("Text_Edit")> _
        Public Message As Object

    is not working still Column Message is not displayed.
    When i use <asp:DynamicField DataField="Message" /> and Autogeneratedcolumns=false
    it displays.
    Whats wrang here

  • Re: nvarchar(max) Columns are not displayed

    05-25-2009, 8:14 AM
    Answer
    • Contributor
      2,060 point Contributor
    • andreadottor
    • Member since 01-25-2007, 10:21 AM
    • Italy
    • Posts 312

    Put only the name of DynamicField without the _edit:

    <UIHint("Text")>

    If this answers your question, please select 'mark as answer' thanks!



    Andrea Dottor
    Microsoft MVP - ASP/ASP.NET
  • Re: nvarchar(max) Columns are not displayed

    05-25-2009, 9:05 AM
    • Member
      46 point Member
    • orimaspnet
    • Member since 06-04-2008, 9:07 AM
    • Posts 94

     still not displaying using <UIHint("Text")>

  • Re: nvarchar(max) Columns are not displayed

    05-27-2009, 12:16 AM
    Answer
    • Contributor
      5,854 point Contributor
    • ricka6
    • Member since 06-25-2008, 6:04 PM
    • Redmond
    • Posts 941
    • AspNetTeam
      Moderator

    nvarchar(max)  would be far to large to display (by default). If you really need nvarchar(max) , you don't want to be showing it. If you want to display something more reasonable, say nvarchar(5000) you should create a field template that checks the length, then displays the field. The UIHint suggestion should work - altho it's probably the wrong approach. I'll test it tomorrow.

    Rick -ASP.Net UE MVC FAQ   Rick on MVC & Dynamic Data   
  • Re: nvarchar(max) Columns are not displayed

    05-27-2009, 2:55 PM
    • Contributor
      5,854 point Contributor
    • ricka6
    • Member since 06-25-2008, 6:04 PM
    • Redmond
    • Posts 941
    • AspNetTeam
      Moderator

    UIHint  does not work. I'll come up with an alternative approach. Actually, UIHint shows the column on edit and details view, just not in the List view. The right way to do this is copy the text field template to text_Big and truncate the text to something reasonable in the text_Big template. You don't really want to show 100 pages of text do you?

    If you want to show the first N chars in the list view, I need to work on that.

    Rick -ASP.Net UE MVC FAQ   Rick on MVC & Dynamic Data   
  • Re: nvarchar(max) Columns are not displayed

    07-01-2009, 12:48 PM
    Answer
    • Member
      12 point Member
    • sysmo
    • Member since 07-01-2009, 4:45 PM
    • Posts 1

    If you are using LINQ to SQL (a .dbml file), you can search/replace "NVarChar(MAX)" in the source code of the .designer.cs file.  Replace with something like "NVarChar(4000)" and the attribute describing the column will be updated for all fields associated with nvarchar(MAX) column types.  When you recompile and run the website, these columns will now be shown.  This is obviously a "hack" and may cause problems in certain situations, but it will display the colum in listings for you.

  • Re: nvarchar(max) Columns are not displayed

    07-01-2009, 2:21 PM
    • Contributor
      5,854 point Contributor
    • ricka6
    • Member since 06-25-2008, 6:04 PM
    • Redmond
    • Posts 941
    • AspNetTeam
      Moderator

    This problem will be fixed in .Net 4 where you can use UIHint(“MulitlineText”)

    Rick -ASP.Net UE MVC FAQ   Rick on MVC & Dynamic Data   
Page 1 of 1 (9 items)