hide column

5 posts, 1 answers
  1. Syed
    Syed avatar
    74 posts
    Member since:
    Mar 2009

    Posted 05 May 2009 Link to this post

    Hi,

    I want to hide few columns when the button is clicked.

    thanks.
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 05 May 2009 Link to this post

    Hello Syed,

    You can try out the following code to hide a column on a button click:
    c#:
     protected void Button1_Click(object sender, EventArgs e) 
        { 
            RadGrid1.MasterTableView.GetColumn("ColumnUniqueName").Display = false
                    
        } 

    Thanks
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mark Galbreath
    Mark Galbreath avatar
    171 posts
    Member since:
    Jul 2009

    Posted 04 Feb 2010 Link to this post

    How would that be done on the client, Princy?
  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 04 Feb 2010 Link to this post

    Hi Mark,

    Here's the client side code to hide columns on a button's click event:
    js:
    function btnClick() 
         { 
            var colindex = $find("RadGrid1").get_masterTableView().getColumnByUniqueName("UniqueName").get_element().cellIndex; 
            $find("RadGrid1").get_masterTableView().hideColumn(colindex); 
               
        } 

    Thanks
    Princy.
  6. Mark Galbreath
    Mark Galbreath avatar
    171 posts
    Member since:
    Jul 2009

    Posted 05 Feb 2010 Link to this post

    Wierd.  I have
    var tableView = $find('<%= radGrid1.ClientID %>').get_masterTableView();    
    tableView.HideColumn( tableView.getColumnByUniqueName( uniqueColumnName ).get_element().cellIndex ); 
    which is the equivalent of what you wrote, Princy, and it doesn't work.

    Cheers!
    Mark
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017