This is a migrated thread and some comments may be shown as answers.

Showing/Hiding grid column

1 Answer 85 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Anne Chinn
Top achievements
Rank 1
Anne Chinn asked on 16 Oct 2008, 07:46 PM
I have a grid for which I want to hide (or disable) the Delete/Edit columns when the app is in a certain state.  I have tried setting the Visible property on the columns in several event handlers in the code-behind, but once I have set the column visibility to false, it stays false, even when the code to reset it to visible is executed. 

Can you give me an example of how to do this?

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 17 Oct 2008, 04:27 AM
Hi Anne,

Try hiding the Grid Column using the Display property and see if it is working.

CS:
 protected void Button1_Click(object sender, EventArgs e) 
    { 
        foreach (GridColumn col in RadGrid1.MasterTableView.RenderColumns) 
        { 
            if (col.ColumnType == "GridEditCommandColumn") 
            { 
                col.Display = !col.Display; 
            }  
        } 
    } 


Thanks
Shinu.
Tags
Grid
Asked by
Anne Chinn
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or