Using Custom Properties with GridView

Posts   
 
    
djones_st
User
Posts: 7
Joined: 08-Jan-2007
# Posted on: 08-Jan-2007 05:22:55   

I have created 2 custom properties on one of my entity classes to return 2 text fields, but replace all line returns with a <br /> so that the line returns will display when viewed in HTML.

These new properties show up on the entity class, but for some reason do not show up when I bind a datasource to a gridview, formview, etc.

Any help would be appreciated.

thx,

dj

Custom Code:

region Custom Entity code

    // __LLBLGENPRO_USER_CODE_REGION_START CustomEntityCode
    public virtual System.String SummaryHtml
    {
        get
        {
            object valueToReturn = base.GetCurrentFieldValue((int)PageFieldIndex.Summary);
            if (valueToReturn == null)
            {
                valueToReturn = TypeDefaultValue.GetDefaultValue(typeof(System.String));
            }
            return ((System.String)valueToReturn).Replace("\n","<br />");
        }

    }

    public virtual System.String DetailsHtml
    {
        get
        {
            object valueToReturn = base.GetCurrentFieldValue((int)PageFieldIndex.Details);
            if (valueToReturn == null)
            {
                valueToReturn = TypeDefaultValue.GetDefaultValue(typeof(System.String));
            }
            return ((System.String)valueToReturn).Replace("\n", "<br />"); ;
        }

    }

    // __LLBLGENPRO_USER_CODE_REGION_END
    #endregion
Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 08-Jan-2007 07:35:58   

To display HTML tags inside a GridView column, set the column's (boundField's)HtmlEncode = false;