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

3 posts, 1 answers
  1. kronnos_indigo
    kronnos_indigo avatar
    61 posts
    Member since:
    Jul 2006

    Posted 15 Jun 2010 Link to this post

    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. Answer
    Yavor Georgiev
    Admin
    Yavor Georgiev avatar
    982 posts

    Posted 16 Jun 2010 Link to this post

    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.
  3. DevCraft banner
  4. kronnos_indigo
    kronnos_indigo avatar
    61 posts
    Member since:
    Jul 2006

    Posted 17 Jun 2010 Link to this post

    thanks Yavor for your example Help.
Back to Top