DataBinding and custom controls

2 posts, 1 answers
  1. Michael
    Michael avatar
    33 posts
    Member since:
    Mar 2009

    Posted 21 Apr 2009 Link to this post

    Hello -

    If I set the FieldName of a databound column, the corresponding values are displayed within the column.  This is normally desirable.  However, I happen to be using a custom element in that column, and the text drawn by the grid interferes with my element's visualization.  If I do not set the FieldName of the column, the problem disappears.  However, I then cannot sort or group the column.  Is there a way for me to sort/group by a databound column without the grid displaying the value of the column in the cells?

    - Mike
  2. Answer
    Jack avatar
    2335 posts

    Posted 23 Apr 2009 Link to this post

    Hi Michael,

    Yes, this is possible. You should handle the CellFormatting event and set the Text property to an empty string. Here is a sample:

    void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e) 
        if (e.CellElement.ColumnIndex == 1) 
            e.CellElement.Text = ""

    I hope this helps. Should you have any other questions, feel free to ask.

    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. DevCraft R3 2016 release webinar banner
Back to Top