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

select column by Uniquename

1 Answer 177 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Trinh Nguyen
Top achievements
Rank 1
Trinh Nguyen asked on 21 Apr 2010, 09:11 PM
Hi,
I'm working on the newest version of Telerik Gridview, I would like to get access to the whole column of the Tableview by Uniquename and make the whole column invisible. Can you provide me a full example how to do it? Thanks in advance

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 22 Apr 2010, 06:13 AM
Hello Trinh,

You could access teh column by using the GetColumn() method as shown below and set the Visible property to false.

aspx:

<Columns> 
       <telerik:GridBoundColumn DataField="EmployeeID" HeaderText="EmployeeID" UniqueName="EmployeeID"
       </telerik:GridBoundColumn> 
       <telerik:GridBoundColumn DataField="Firstname" HeaderText="Firstname" UniqueName="Firstname"
       </telerik:GridBoundColumn> 
       <telerik:GridCheckBoxColumn DataField="isapproved" HeaderText="isapproved" UniqueName="CheckBoxColumn" 
                    DataType="System.Boolean"
       </telerik:GridCheckBoxColumn> 
       <telerik:GridDropDownColumn UniqueName="DropDownListColumn" ListTextField="Country" 
                    ListValueField="Country" DataSourceID="SqlDataSource2" HeaderText="Country" DataField="Country" 
                    DropDownControlType="RadComboBox"
       </telerik:GridDropDownColumn> 
       <telerik:GridButtonColumn ButtonType="LinkButton" UniqueName="LinkButton1" Text="Edit" 
                    CommandName="Edit"

       </telerik:GridButtonColumn>

            . . .

 </Columns> 

cs:
protected void Page_Load(object sender, EventArgs e) 
    { 
        RadGrid1.MasterTableView.GetColumn("EmployeeID").Visible = false
        RadGrid1.MasterTableView.GetColumn("Firstname").Visible = false
        RadGrid1.MasterTableView.GetColumn("CheckBoxColumn").Visible = false
        RadGrid1.MasterTableView.GetColumn("DropDownListColumn").Visible = false
        RadGrid1.MasterTableView.GetColumn("LinkButton1").Visible = false
         
    } 

Feel free to share the comments,

Shinu.
Tags
Grid
Asked by
Trinh Nguyen
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or