Contact Sales: +1-888-365-2779
Community & Support
Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Grid > HTML tags and special characters
RadControls for ASP.NET are no longer supported (see this page for reference). In case you have inquiries about the Telerik ASP.NET AJAX controls, post them in the pertinent ASP.NET AJAX forums.

Not answered HTML tags and special characters

Feed from this thread
  • alexeis avatar

    Posted on Aug 9, 2007 (permalink)

    Hi,

    I am using the Grid control to bind to the database and display information on the ASP.NET page. Some of the columns in the dataset may contain html content, for example, <input> somewhere in the middle of the string. Such content is treated literally and displayed as a textbox in the middle of the grid.

    Is there a way to specify that all content inside the grid should be displayed as text?

    Thank you,
    Alexei

  • Giuseppe Giuseppe admin's avatar

    Posted on Aug 9, 2007 (permalink)

    Hello alexeis,

    You can html encode the column "Content" text by handling the ItemDataBound event like this:

     
    protected void RadGrid1_ItemDataBound(object sender, Telerik.WebControls.GridItemEventArgs e) 
        if (e.Item is GridDataItem) 
        { 
            GridDataItem item = e.Item as GridDataItem; 
            item["Content"].Text = Server.HtmlEncode(item["Content"].Text); 
        } 



    All the best,
    Manuel
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center

  • alexeis avatar

    Posted on Aug 9, 2007 (permalink)

    Thank you so much, it works!

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Grid > HTML tags and special characters