Problem hidding the column in ContextMenu

2 posts, 0 answers
  1. Sudha
    Sudha avatar
    27 posts
    Member since:
    May 2011

    Posted 08 Nov 2011 Link to this post

    I have set EnableHeaderContextMenu= true in the rad grid. In this ContextMenu I am getting all the Column names which are in the grid.
    My requirement is , I want only those coulmns for which i have set Visible = true. I do not want the columns for which i have set Display=False. I do not want to set Visible = False for those particular columns as i want those coulmns to be rendered.
    Kindly help me resolving this issue as early as possible.


  2. Mira
    Mira avatar
    1124 posts

    Posted 09 Nov 2011 Link to this post

    Hello Sudha,

    Please use the following code in order to hide the desired columns from the context menu:
    protected void Page_Init(object sender, EventArgs e)
        RadGrid1.HeaderContextMenu.ItemCreated += new RadMenuEventHandler(HeaderContextMenu_ItemCreated);
    void HeaderContextMenu_ItemCreated(object sender, RadMenuEventArgs e)
        if (e.Item.Value.Contains("ColumnUniqueName"))
            e.Item.Visible = false; //hide the desired column

    I hope this helps.

    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. DevCraft R3 2016 release webinar banner
Back to Top