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

to hide editcolumn

4 Answers 82 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
abinav
Top achievements
Rank 1
abinav asked on 23 May 2011, 12:39 PM
hi

i have a grid in which the autogenerate edit option is enabled and i want only to insert a new record and after inserting the new record i want to hide the edit option

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 23 May 2011, 01:07 PM
Hello Abhinav,

Try the following code snippet to hide edit column after inserting the item. Hope this helps you.

C#:
protected void RadGrid1_InsertCommand(object sender, GridCommandEventArgs e)
   {
       GridColumn col = (GridColumn)RadGrid1.MasterTableView.GetColumn("AutoGeneratedEditColumn");
       col.Visible = false;
   }

Thanks,
Princy.
0
abinav
Top achievements
Rank 1
answered on 23 May 2011, 05:21 PM
hi princy

i tried this
GridColumn col = (GridColumn)RadGrid1.MasterTableView.GetColumn("AutoGeneratedEditColumn")

but got an error stating cannot find a column with uniquename AutoGeneratedEditColumn

instead i tried it in prerender event but the editcolumn is not visible while loading itself how to check whether it is in edit mode or not in prerender event
0
Princy
Top achievements
Rank 2
answered on 24 May 2011, 08:27 AM
Hello Abhinav,

If you are using AutoGeneratedEditColumn, then ColumnUniqueName is "AutoGeneratedEditColumn". If you are using GridEditCommandColumn or GridButtonColumn with CommandName "Edit", then you can access the column by setting the UniqueName property. Please elaborate your scenario if it doesn't help.

Thanks,
Princy.
0
abinav
Top achievements
Rank 1
answered on 24 May 2011, 11:03 AM
hi princy

thanks a lot i tried the following

radgrid1.Columns[2].Visible = false; and it partially  solves the problem
Tags
General Discussions
Asked by
abinav
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
abinav
Top achievements
Rank 1
Share this question
or