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

Maintaining cell State

7 Answers 24 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Steven
Top achievements
Rank 1
Steven asked on 12 Jul 2011, 01:20 PM
Good morning,

Some of my cells must be Disabled

GridViewRow row = (GridViewRow)this.grid.ItemContainerGenerator.ContainerFromItem(item);
                        grid.Cells[2].IsEnabled = false;

But when I check the value of the property "Cell.IsEnable", it stays to True.
The State of my cell is not maintained...

How can I maintained it ?

Regards,
S

7 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 12 Jul 2011, 01:24 PM
Hi,

 It will be better to use StyleSelectors since the grid is UI virtual component and containers like cells, rows, etc. will be recycled during scrolling, sorting, etc. 

All the best,
Vlad
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Steven
Top achievements
Rank 1
answered on 12 Jul 2011, 01:39 PM
In fact my Cell state depends on another state.
How can I handle this with a StyleSelector ?

Thanks,

PS : If you post a sample, please no .zip. I am not allowed to open thus files.
0
Vlad
Telerik team
answered on 12 Jul 2011, 01:42 PM
Hi,

 Have you checked the demo I've posted? You can check also our documentation and local version of the demos as well. 

All the best,
Vlad
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Steven
Top achievements
Rank 1
answered on 12 Jul 2011, 02:06 PM
Yes, I have checked the demo and the sample code.
But the style selector does not depend on another cell.
0
Vlad
Telerik team
answered on 12 Jul 2011, 02:27 PM
Hi,

 You have access to the data item itself and you can check any property.

Greetings,
Vlad
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Steven
Top achievements
Rank 1
answered on 12 Jul 2011, 02:59 PM
I have use the style selector but it did not resolved my problem...

In fact, when I click on cell which should be Disabled, the first cell of the row is selected.
I need to remove this selection because the user should not be able to click on a disabled cell...

I tried to cancel the CurrentCellChanged but the newCell.IsEnable stays at true...

Regards,
S
0
Dimitrina
Telerik team
answered on 15 Jul 2011, 02:37 PM
Hello Steven,

 The behavior of the disabled cells that you have described is actually by design. When you have a disabled cell, then the UI hits it as not visible, so it does not receive the mouse events - it cannot be selected, it cannot be clicked. This causes that the underlying row receives the click. You will get the same if you click on the end of a row, where you have an empty space after the columns(cells).

When the row is clicked, then the first cell of the row is focused by default. The CurrentCellChanged event is fired by the focusing of the first cell of the row(as the row receives the click), not by selecting the Disabled cell.

Nevertheless, your point is reasonable, so we will discuss this case for eventual future improvements.

All the best,
Didie
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
GridView
Asked by
Steven
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Steven
Top achievements
Rank 1
Dimitrina
Telerik team
Share this question
or