Radgrid not diplaying text in angular braces

8 posts, 0 answers
  1. vishesh kumar
    vishesh kumar avatar
    24 posts
    Member since:
    Sep 2009

    Posted 19 Sep 2010 Link to this post

    Hi, 
    I have used radgrid to display some search records. However, I am not able to records like "<keyword>" which are however returned from the stored procedure and part of the datasource that is used to bind.

    <telerik:GridHyperLinkColumn DataTextFormatString="{0}" DataNavigateUrlFields="Id"
                                                                        DataNavigateUrlFormatString="/sites/abc/xyz/vhj/Pages/view.aspx?id={0}&ReturnUrl=/Pages/Search.aspx"
                                                                        UniqueName="ItemTitle" DataTextField="Title" HeaderText="Title" SortExpression="Title"
                                                                        HeaderStyle-CssClass="ms-toolbar" HeaderStyle-Width="17%" HeaderStyle-HorizontalAlign="Left"
                                                                        ItemStyle-HorizontalAlign="Left" ItemStyle-Wrap="true" SortAscImageUrl="/_layouts/Images/abc/SortAsc.gif"
                                                                        SortDescImageUrl="/_layouts/Images/abc/SortDesc.gif" DataType="System.String" >
                                                                    </telerik:GridHyperLinkColumn>
    This is my column definition.

    Can you please let me know if there is a workaround for this or this is a feature?
  2. Daniel
    Admin
    Daniel avatar
    4945 posts

    Posted 23 Sep 2010 Link to this post

    Hello Vishesh,

    You should set the HtmlEncode property to true - this way RadGrid will encode the HTML-like content automatically.
    <telerik:GridBoundColumn HtmlEncode="true" ...

    Regards,
    Daniel
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Stimo
    Stimo avatar
    1 posts
    Member since:
    Aug 2012

    Posted 26 Aug 2012 Link to this post

    Hi,

    You can do that if your column is GridBoundColumn, but what about GridTemplateColumn? It doesn't have HtmlEncode property
  5. Daniel
    Admin
    Daniel avatar
    4945 posts

    Posted 30 Aug 2012 Link to this post

    Hello Stimo,

    You should manually encode the text when using templates.

    In such cases, you can use the HtmlEncode method:

    Regards,
    Daniel
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  6. Tonino
    Tonino avatar
    107 posts
    Member since:
    Nov 2007

    Posted 14 Oct in reply to Daniel Link to this post

    Hi!

    Is there a way to set HtmlEncode="true" for the whole Grid? Or for the whole project?

    Regards,

    Tonino.

  7. Daniel
    Admin
    Daniel avatar
    4945 posts

    Posted 14 Oct Link to this post

    Hello Tonino,

    There is no built-in functionality to set HtmlEncode property for all columns. If suitable for you, it is possible to traverse the columns collection and assign the property to all bound columns programmatically.
    foreach (GridColumn col in RadGrid4.Columns)
    {
        GridBoundColumn boundCol = col as GridBoundColumn;
        if (boundCol != null)
        {
            boundCol.HtmlEncode = true;
        }
    }

    For autogenerated columns try the following approach:
    Customizing auto-generated columns

    Regards,
    Daniel
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  8. Tonino
    Tonino avatar
    107 posts
    Member since:
    Nov 2007

    Posted 14 Oct in reply to Daniel Link to this post

    Thanks Daniel for your quick reply!

    Where do I have to put the code to loop throu the columns?

    Regards,

    Tonino.

  9. Daniel
    Admin
    Daniel avatar
    4945 posts

    Posted 17 Oct Link to this post

    Hello Tonino,

    You could try to set the HtmlEncode property on page load:
    protected void Page_Load(object sender, EventArgs e)
    {
        foreach (GridColumn col in RadGrid1.Columns)
        {
            GridBoundColumn boundCol = col as GridBoundColumn;
            if (boundCol != null)
            {
                boundCol.HtmlEncode = true;
            }
        }
    }

    Regards,
    Daniel
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017