Button in the Group of gridview

2 posts, 0 answers
  1. Ramraj
    Ramraj avatar
    3 posts
    Member since:
    Sep 2015

    Posted 28 Sep 2015 Link to this post



    I have a grid view which has a grouping, I want to have a button within the group, is it possible, the image has been attached & I want a button next to

    "Rule Name :Galaxy"





  2. Dimitar
    Dimitar avatar
    2983 posts

    Posted 29 Sep 2015 Link to this post

    Hi Ramraj,

    Thank you for writing.

    You can create a custom GridGroupContentCellElement class, where you can add the button:
    public class CustomCellElement : GridGroupContentCellElement
        public CustomCellElement(GridViewColumn column, GridRowElement row)
            : base(column, row)
        RadButtonElement buttonElement;
        protected override void CreateChildElements()
            buttonElement = new RadButtonElement();
            buttonElement.Text = "testButton";
            buttonElement.StretchHorizontally = false;
            buttonElement.StretchVertically = false;
            buttonElement.Alignment = ContentAlignment.MiddleRight;
        protected override Type ThemeEffectiveType
                return typeof(GridGroupContentCellElement);

    You can use the CreateCell event to change the default cell element with the custom one:
    void radGridView1_CreateCell(object sender, GridViewCreateCellEventArgs e)
        if (e.CellType == typeof(GridGroupContentCellElement))
            e.CellElement = new CustomCellElement(e.Column, e.Row);

    I hope this will be useful.

    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 Feedback Portal and vote to affect the priority of the items
Back to Top