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

GridViewRow single click event

8 Answers 237 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Pawel
Top achievements
Rank 1
Pawel asked on 09 Jul 2010, 09:44 AM
Hi,
I'm trying to implement expand/collapse of row details after row is clicked, however I cannot find a way to handle row 'single click' event (left mouse button down or left mouse button up). RowDetailsVisibilityMode="VisibleWhenSelected" is not satisfactory because it allows to display details of only one row at a time. SelectionChanged event also will not do, because it does not fire when the selected row is clicked again.
Is there a way to handle simple row click event ?

regards
Pawel

8 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 09 Jul 2010, 09:55 AM
Hello Pawel,

 If you want multiple row-details opened why not use GridViewToggleRowDetailsColumn instead?

Regards,
Vlad
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
0
Pawel
Top achievements
Rank 1
answered on 09 Jul 2010, 10:11 AM
Because of user experience. I think it is much easier to expand / collapse after clicking the whole row than by clicking only one, specific column.

regards
Pawel
0
Milan
Telerik team
answered on 09 Jul 2010, 01:07 PM
Hi Pawel,

You could also try to set SelectionMode to Extended, which will allow you to select multiple items and ultimately multiple row details in opened state. 


Sincerely yours,
Milan
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
0
Pawel
Top achievements
Rank 1
answered on 09 Jul 2010, 01:47 PM
Setting SelectionMode to Multiple and RowDetailsVisibilityMode to VisibleWhenSelected gave the result that I expected.
There is only a minor issue - when the column is not read only (IsReadOnly="False) ,after double clicking it, the textbox appears, I click the next column of the same row so the textbox disappears - the details remain expanded regardless of how many times I click columns of this row. To collapse the details of this row I have to click some other row, and then click the previous row.

regards
Pawel
0
Accepted
Milan
Telerik team
answered on 12 Jul 2010, 11:19 AM
Hi Pawel,

Then you might consider using the Multiple SelectionMode? In this mode a row can be selected/deselected with the mouse only - clicking on a previously selected row will unselect the row. Is that the functionality that you are looking for?


Greetings,
Milan
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
0
Pawel
Top achievements
Rank 1
answered on 12 Jul 2010, 05:03 PM
Yes, thank you.

regards
Pawel
0
Rodney
Top achievements
Rank 1
answered on 22 Dec 2010, 03:56 AM
I have a similar issue. I have a GridView with a RowTemplate that shows some information about that row. When you click on the row it opens up a detailed view using the ItemID.

I currently use the SelectionChanged event to open the detail page (I use the RowToggleExpander Telerik column to show and hide the row template). I can open the item detail view with the selected ItemID when I click on a row, but when I come back to the grid I can't click on the selected row again to open it (becuase SelectionChanged does not fire).

Is there a simple way to capture the RowClicked event and pass in an ID for that row?

Thanks
0
Rodney
Top achievements
Rank 1
answered on 22 Dec 2010, 04:55 AM
I came up with a hacky fix for this so that I can still use the SelectionChanged Event to get one click handling on grid rows - on the Navigated to event I set the SelectedItem to null if it is selected. This means if you click on the same row that was selected it fires again.

It's not very nice but better than attaching a mousedown event to every single row I think - can anyone suggest a better way please?
Tags
GridView
Asked by
Pawel
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Pawel
Top achievements
Rank 1
Milan
Telerik team
Rodney
Top achievements
Rank 1
Share this question
or