Different Header Context Menu for each Radgrid column

4 posts, 0 answers
  1. Sathya
    Sathya avatar
    9 posts
    Member since:
    Jul 2012

    Posted 24 Jul 2012 Link to this post


        I am working on Radgrid, i tried to create different header context menu for each column in "OnPreRenderComplete", but the grid repeat the same menu for each column. The code i tried is here. 

      protected override void OnPreRenderComplete(EventArgs e)
            RadContextMenu menu = AnswerGenMainGrid1.HeaderContextMenu;
            foreach (GridColumn gridColumn in AnswerGenMainGrid1.MasterTableView.RenderColumns)
                RadMenuItem columnItem = new RadMenuItem();
                columnItem.Attributes["ColumnName"] = "";
                columnItem.Attributes["TableID"] = "";
                columnItem.Value = "∑";
                columnItem.Text = "∑";
                columnItem.PostBack = true;
                RadMenuItem columnItem1 = new RadMenuItem();
                columnItem1.Attributes["ColumnName"] = "";
                columnItem1.Attributes["TableID"] = "";
                columnItem1.Value = "%";
                columnItem1.Text = "%";
                columnItem1.PostBack = true;


    I know here i am creating one menu and adding it to all columns. But i couldn't find anyother sample code for creating different menu item for different columns in grid.

    Is there anyother solution to implement this?
  2. Milena
    Milena avatar
    257 posts

    Posted 27 Jul 2012 Link to this post

    Hello Sathya,

    You can achieve your goal as use OnHeaderMenuShowing client event, there you can access RadMenu collection of items and depending on the column to add/remove items. More information about the methods, which could be used, find here.

    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.
  3. G
    G avatar
    10 posts
    Member since:
    Jul 2013

    Posted 10 Dec 2017 Link to this post

    In the radgrid header context menu, while deselecting all the columns from the menu but we can not deselect the last column as it is read only. Is it possible to deselect the last column also?
  4. Eyup
    Eyup avatar
    3953 posts

    Posted 13 Dec 2017 Link to this post


    This is the default behavior. The last column, which remains visible regardless of its order position, will have its checkbox disabled in order to prevent hiding it. Otherwise, the grid will lose its structure and the user won't be able to see any data.

    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top