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

[Solved] Set edit column visible=false

3 Answers 188 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Nancy Cara
Top achievements
Rank 1
Nancy Cara asked on 26 Feb 2008, 10:52 PM
I have a self-hierarchy grid that has three boolean columns IsText, IsDate, IsParty. 

I want to set three other columns visiblility in edit mode to the value of the boolean fields. i.e. ...


EditTextColumn.visible = IsText;
EditDateColumn.visible = IsDate;
EditPartyColumn.visible = IsParty;

Where would this best be done? I am trying the ItemCommand but can't seem to cast the selected item to columns so I can set visibility.

3 Answers, 1 is accepted

Sort by
0
Nancy Cara
Top achievements
Rank 1
answered on 27 Feb 2008, 04:19 AM
Actually it is not the visible property I need to change. I want the column to be not editable if boolean column is false. I guess that is readonly and/or display properties?  I'm not sure if I should set this on editcommand or on databound since all the columns are auto generated and each row will have different boolean values.

i.e. data looks like this:
ID, Name, ParentID,  IsDate, IsText, IsParty, EditDate, EditText  EditParty

1,'Brochure mailed',0,0,0,0,null,null,null
2,'Date mailed',1,0,0,0,'12/12/2007',null,null
3,'Mailed by',1,0,0,1,null,null,1001

Row 2 isdate=true, istext=false, isparty=false - so only EditDate is editable.
Row 3 isdate=false, istext=false, isparty=true so only EditParty is editable
0
Iana Tsolova
Telerik team
answered on 27 Feb 2008, 03:09 PM
Hello Nancy Cara,

Yes, you need to use the Readonly property of the RadGrid. And you can handle the EditCommand for your purpose. I've made a sample project for you. Please have a look at it and let us know if that helps.


Kind regards,
Iana
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Nancy Cara
Top achievements
Rank 1
answered on 27 Feb 2008, 06:55 PM
Thank-you Iana. Your example does not use a self-hierarchy grid so that may be the problem. I have opened a support ticket #124093 for help on this as I have spent enough hours on it and must move on.

Basically the editcommand fires on edit click and does appear to set readonly to false/true however the edit boxes appear in edit mode fully editable every time regardless.

Tags
Grid
Asked by
Nancy Cara
Top achievements
Rank 1
Answers by
Nancy Cara
Top achievements
Rank 1
Iana Tsolova
Telerik team
Share this question
or