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

How do I for look what rowIndex is used when I do a click into celltemplate with a checkbox.?

2 Answers 36 Views
GridView
This is a migrated thread and some comments may be shown as answers.
kronnos_indigo
Top achievements
Rank 2
kronnos_indigo asked on 15 Jun 2010, 08:40 PM
Good Afternoon Team Telerik

I have a question refer to How do I  take de row Index when I made click into celltemplete with a checkbox? For this problem cannot I use SelectingColumn.
The XAML code is:
<StackPanel Margin="5" Grid.Row="2" HorizontalAlignment="Left" VerticalAlignment="Top" > 
      <telerikGridView:RadGridView x:Name="gvNombresCamposDinamicos" Margin="5,5,0,0" AutoGenerateColumns="False" SelectionMode="Single" 
            ShowColumnFooters="True" CanUserFreezeColumns="False" ScrollMode="RealTime" FrozenColumnCount="2" 
            DataLoadMode="Asynchronous" HorizontalAlignment="Left" EnableRowVirtualization="True" EnableColumnVirtualization="True" 
            ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollBarVisibility="Visible" Width="1063" > 
        <telerikGridView:RadGridView.Background> 
          <RadialGradientBrush> 
            <GradientStop Color="#FF91DAE3" Offset="0.025"/> 
            <GradientStop Color="#FF75C9E7" Offset="0.753"/> 
            <GradientStop Color="#FF8191DA" Offset="0.321"/> 
            <GradientStop Color="#FF9481DA" Offset="0.321"/> 
          </RadialGradientBrush> 
        </telerikGridView:RadGridView.Background> 
        <telerikGridView:RadGridView.Columns > 
          <telerikGridView:GridViewColumn Header="Prot" UniqueName="Protegida"
            <telerikGridView:GridViewColumn.CellTemplate UniqueName="Prot1"
              <DataTemplate> 
                <CheckBox x:Name="chkEstadoCampo" HorizontalAlignment="Left" Checked="actualizarEstadoBotonAgregarItem" Unchecked="actualizarEstadoBotonAgregarItem" 
                                  VerticalAlignment="Top" Content="" IsChecked="True"/> 
              </DataTemplate> 
          </telerikGridView:GridViewColumn.CellTemplate>                         
          </telerikGridView:GridViewColumn> 
                    <telerikGridView:GridViewDataColumn Header="codEmpresa" DataMemberBinding="{Binding codEmpresa}"  IsReadOnly="True" UniqueName="codEmpresa" Width="40" IsVisible="False" /> 
                    <telerikGridView:GridViewDataColumn Header="Empresa" DataMemberBinding="{Binding Nombre}"  IsReadOnly="True" UniqueName="Nombre" Width="140" /> 
                    <telerikGridView:GridViewDataColumn Header="Entidad" DataMemberBinding="{Binding NombreTabla}"  IsReadOnly="True" UniqueName="NombreTabla" Width="100" /> 
                    <telerikGridView:GridViewDataColumn Header="Campo" DataMemberBinding="{Binding NombreCampo}"  IsReadOnly="True" UniqueName="NombreCampo" Width="120" /> 
                    <telerikGridView:GridViewDataColumn Header="Nuevo nombre" DataMemberBinding="{Binding NombreCampoAlias}"  IsReadOnly="True" UniqueName="NombreCampoAlias" Width="120" /> 
                    <telerikGridView:GridViewDataColumn Header="Nombre abrev" DataMemberBinding="{Binding Abreviado}"  IsReadOnly="True" UniqueName="Abreviado" Width="80" /> 
                    <telerikGridView:GridViewDataColumn Header="Tipo" DataMemberBinding="{Binding TipoDato}"  IsReadOnly="True" UniqueName="TipoDato" Width="50" /> 
                    <telerikGridView:GridViewDataColumn Header="Creado el" DataMemberBinding="{Binding fchCreacion}"  IsReadOnly="True" UniqueName="fchCreacion" Width="80" DataFormatString="{}{0:yyyyMMMdd}" /> 
                    <telerikGridView:GridViewDataColumn Header="Modificado el" DataMemberBinding="{Binding fchModificacion}"  IsReadOnly="True" UniqueName="fchModificacion" Width="80" DataFormatString="{}{0:yyyyMMMdd}" />                            
                  <telerikGridView:GridViewDataColumn Header="codTerceroCrear" DataMemberBinding="{Binding IdTerceroCreador}"  IsReadOnly="True" UniqueName="IdTerceroCreador" Width="40" IsVisible="False" />                           
                    <telerikGridView:GridViewDataColumn Header="Nombre quien crea" DataMemberBinding="{Binding NombreCreador}"  IsReadOnly="True" UniqueName="NombreCreador" Width="140" />                          
                    <telerikGridView:GridViewDataColumn Header="codTerceroMod" DataMemberBinding="{Binding IdTerceroNMod}"  IsReadOnly="True" UniqueName="IdTerceroNMod" Width="40" IsVisible="False" />                     
                    <telerikGridView:GridViewDataColumn Header="Nombre quien mod." DataMemberBinding="{Binding NombreModifica}"  IsReadOnly="True" UniqueName="NombreModifica" Width="140" />                            
        </telerikGridView:RadGridView.Columns> 
      </telerikGridView:RadGridView> 
      <telerikGridView:RadDataPager x:Name="rdpGrilla" PageSize="15" DisplayMode="FirstLastPreviousNextNumeric" IsTotalItemCountFixed="True" 
                                    FontFamily="Verdana" FontSize="9" Foreground="Blue" Background="Snow"  
                                    Source="{Binding Items, ElementName=gvNombresCamposDinamicos}" > 
         
      </telerikGridView:RadDataPager> 
      <Button Height="0" Width="304" Content="Button"/> 
    </StackPanel> 
And VB code:
Protected Sub actualizarEstadoBotonAgregarItem(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) 
    Dim m, d As String, p As Integer 
    m = "actualizarEstadoBotonAgregarItem)-" : d = "Entra" : p = 0 
    Try 
      'MessageBox.Show(o & vbCrLf & m & p & d, "", MessageBoxButton.OK) 
 
      p = 10 : imbActualizarDatos.Visibility = IIf(sender.IsChecked, Windows.Visibility.Collapsed, Windows.Visibility.Visible) 
      If Not sender.IsChecked Then 
        rcbTablas.Focus() 
      End If 
    Catch ex As Exception 
      MessageBox.Show("Revisar: " & o & vbCrLf & m & p & vbCrLf & ex.Message) 
    End Try 
    d = ") Sale " 
    'p = 999 : MessageBox.Show(o & vbCrLf & m & p & d) 
  End Sub 

In this case, I made click into checkbox "chkEstadoCampo"  in any row, but how I do to know the rowIndex of rhe checkbox that I made checked or unchecked? The sender is the checkbox object but it have not parent object to take this data.


Regards, and thanks for any help.

Juan Pablo Díaz

2 Answers, 1 is accepted

Sort by
0
Accepted
Yavor Georgiev
Telerik team
answered on 16 Jun 2010, 12:58 PM
Hello kronnos_indigo,

 I'm attaching a sample solution that shows how this can be done. Please let me know if you need further assistance.

Regards,
Yavor Georgiev
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
kronnos_indigo
Top achievements
Rank 2
answered on 17 Jun 2010, 04:14 PM
thanks Yavor for your example Help.
Tags
GridView
Asked by
kronnos_indigo
Top achievements
Rank 2
Answers by
Yavor Georgiev
Telerik team
kronnos_indigo
Top achievements
Rank 2
Share this question
or