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

Button clicks on grid to select row prior to command

2 Answers 95 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Marc
Top achievements
Rank 1
Marc asked on 11 Apr 2011, 09:56 PM
I have buttons in a grid view which I am setting the click property. What I need to know is can I force the select row event before my method is called?  

<telerik:GridViewColumn>
	<telerik:GridViewColumn.CellTemplate>
		<DataTemplate>
                	<telerik:RadButton Content="Foo" Click="Foo"/>
		</DataTemplate>
	</telerik:GridViewColumn.CellTemplate>
</telerik:GridViewColumn>

Right now this will call foo prior to selecting the row, so the method is being executed using the wrong row. 

2 Answers, 1 is accepted

Sort by
0
Marc
Top achievements
Rank 1
answered on 11 Apr 2011, 10:42 PM
I was able to add the below:
var selectRow = RadGridViewCommands.SelectCurrentUnit as RoutedUICommand;
            selectRow.Execute(nullthis.FooGrid);

In my code behind to get this to work. I am curious as to why the selected event is not triggered prior to the click event on the button? Seems like it would seem pretty standard that when clicking on a grid you always want the selection done prior to any other actions. I will need to put this in a hand full of spots when it should be part of the base control.
0
Pavel Pavlov
Telerik team
answered on 14 Apr 2011, 09:57 AM
Hello Marc,

Glad  to hear you have managed to find a workaround.
Now on your question  - buttons in Silverlight tend to "eat" the mouse down events thus preventing the containing row to sense  the user mouse button action and set the selected item .  This comes form the Silverlight platform and there is not much we can do about it . So workarounds like yours should be applied.

Regards,
Pavel Pavlov
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
GridView
Asked by
Marc
Top achievements
Rank 1
Answers by
Marc
Top achievements
Rank 1
Pavel Pavlov
Telerik team
Share this question
or