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

Change Cell Type by Row

1 Answer 22 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 1
Dave asked on 26 May 2010, 08:30 PM
I was wondering what the best way to change the cell type by row was.  I have a grid with a column "Value"  and one called "Type" which is a dropdown column.  Say there are two values for "Type" (Text and DD).  If I select "Text" I want the value column to be a textbox where the user can enter data.  If I select "DD" I want the "Value" column to be a Dropdown column.  What I can't figure out is how to change the type of cell (text or dropdown) in the ItemDataBound event.  Thoughts?

1 Answer, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 01 Jun 2010, 09:53 AM
Hi Dave,

You cannot change cell types inside columns. You can change anything inside the cell (remove old text and controls, create new text and controls) using ItemDataBound event, but the default behavior will always be to render the content specified by the column type.

In your particular scenario, you can have a GridTemplateColumn with both a TextBox and a RadComboBox inside the EditItemTemplate. You can then check the Type of your data item in ItemDataBound event and programmatically show one of the controls and hide the other.

Regards,
Veli
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
Dave
Top achievements
Rank 1
Answers by
Veli
Telerik team
Share this question
or