Changing cell type?

Randy Hompesch

I'm sure this question has been asked a 1000 times, but this will make 1001. I have a RadGridView and for the purposes of this discussion let make it a single column grid. I set the columntype to GridViewCommandColumn. Let's pretend I have 5 rows of data. On even numbered rows I DON'T want a button or any other editor/control. I just want a readonly bit of text to show (or no text at all for that matter). Basically, I want to change the even numbered rows/cells to a different cell type. In this case I want a readonly textbox or something similar. More generically, I want to know how to change individual cells at both design and runtime. Is this doable? If so, I could sure use some guidance.

If you will have a single column grid only, it is recommended to use RadDataEntry or RadDataLayout control. Thus, you can obtain different editors for each row.

I hope this information helps. Should you have further questions I would be glad to help.

Regards,
Dess
Telerik

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 Feedback Portal and vote to affect the priority of the items

Randy Hompesch

I'm getting closer to what I need with your help! Thanks. In the CellFormatting event there is a CellFormattingEventArgs e. e has a CellElement property. How can I get the CellElement for grd.Rows[e.RowIndex].Cells["MyFavoriteCell"]? What I am trying to do, is to look at the value of a cell and if it has a value that I am looking for, I want to hide all the other cells in the row. Can you get me going in the right direction?

Thanks ... Ed

Dess

You can get the value by using the CellFormattingEventArgs.CellElement.Value property. Thus, you can determine how to customize the cell. Note that RadGridView uses visual cell elements to display only the currently visible data and these visual cell elements are being reused when scrolling for example. In order to indicate that a certain element in the cell should not be visible, you can use the GridViewCellInfo.Tag property to store any useful information that can be used later in the CellFormatting event.

I hope this information helps. If you have any additional questions, please let me know.

Regards,
Dess
Telerik

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 Feedback Portal and vote to affect the priority of the items

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks or appropriate markings.