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

RadgridView Checkboc event

1 Answer 66 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
manohar
Top achievements
Rank 1
manohar asked on 12 Sep 2011, 10:14 PM
I have the following gridView

 

 

 

<telerik:RadGridView IsReadOnly="True" AutoGenerateColumns="False" ShowGroupPanel="False" Grid.Column="1" Margin="2,2,2,2"

 

 

 

CanUserReorderColumns="False" CanUserResizeColumns="True" Width="Auto"

 

 

 

RowIndicatorVisibility="Collapsed" IsFilteringAllowed="False" MaxHeight="300" MinHeight="40"

 

 

 

ItemsSource="{Binding Path=TestDetails}" telerik:StyleManager.Theme="Office_Blue" GridLinesVisibility="None">

 

 

 

 

<telerik:RadGridView.Columns>

 

 

 

 

<telerik:GridViewDataColumn x:Name="Activate" Header="Acitve" TextAlignment="Center" >

 

 

 

 

<telerik:GridViewDataColumn.CellTemplate>

 

 

 

 

<DataTemplate>

 

 

 

 

<CheckBox IsChecked="{Binding ActiveFlag, Mode=TwoWay}" Width="17" Height="17"

 

 

 

cal:Message.Attach="[Event Checked] = [Action ActivateDeActivate($datacontext,$eventArgs)];[Event Unchecked] = [Action ActivateDeActivate($datacontext,$eventArgs)]">

 

 

 

 

</CheckBox>

 

 

 

 

</DataTemplate>

 

 

 

 

</telerik:GridViewDataColumn.CellTemplate>

 

 

 

 

</telerik:GridViewDataColumn>

 

 

 

 

<telerik:GridViewDataColumn x:Name="AccountNumber" IsReorderable="False" Header="AccountNumber" DataMemberBinding="{Binding Path=AccountNumber, Mode=TwoWay}" TextTrimming="WordEllipsis" Width="200" ToolTipTemplate="{StaticResource AccountNumberTooltip}"/>

 

 

 

 

<telerik:GridViewDataColumn x:Name="Notes" IsReorderable="False" Header="Notes" DataMemberBinding="{Binding Path=Notes, Mode=TwoWay}" TextTrimming="WordEllipsis" Width="400" ToolTipTemplate="{StaticResource NotesTooltip}"/>

 

 

 

 

</telerik:RadGridView.Columns>

 

 

 

 

</telerik:RadGridView>

 


ActivateDeActivate is the eventHandler for checkBox , but the event is firing even when i try to sort Account Number.Is there any way to raise this event only when i  check/uncheck checkboxes.

Thanks for your help.

1 Answer, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 13 Sep 2011, 09:19 AM
Hello Manohar,

The reason  for this to happen is that when you sort , cells are being recreated , rebound and when this happens the checked state of the checkbox is changed to match the underlying checkbox.

The solution should be pretty straightforward - you can use the Click event of the checkbox .

Regards,
Pavel Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
General Discussions
Asked by
manohar
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Share this question
or