Cannot show selected data in Combobox Column Cell

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

    Posted 21 Jan 2011 Link to this post

    Good afternoon Team Telerik

    I have a problem because the page SIlverL when ended of run, the new runtime add combobox column in RadGrid don´t show nothing But the combobox in column have the data relation with primary data in radgrid:

    Private Sub rgvRegistroTabla_DataLoaded(ByVal sender As Object, ByVal e As System.EventArgs) Handles rgvRegistroTabla.DataLoaded
      ' *************************************************** 2011Ene17 JPDS
      Dim m, d As String, p As Integer
      m = "rgvRegistroTabla_DataLoaded)-" : d = "Entra" : p = 0
     
      Dim columna As New GridViewColumn
      Dim hayRelaciones As Boolean = False
      Try
        If sender.GroupCount > 0 Then
          tipoAdicionCol = 0
        End If
        If tipoAdicionCol = 1 Then
          'MessageBox.Show(m & vbCrLf & d & vbCrLf & p)
          p = 10
          ' Lee las relaciones existentes y carga los datos de las tablas origen
          If Not IsNothing(arrRelaciones(0)) Then
            hayRelaciones = True
          End If
          If hayRelaciones Then
            p = 25
            Dim columnaCombo As New GridViewComboBoxColumn()
            p = 50
            For Each columna In rgvRegistroTabla.Columns
              If columna.UniqueName = arrRelaciones(2) Then
                p = 60 : columnaCombo.UniqueName = arrRelaciones(2).ToString & "2"
                p = 70 : columnaCombo.Header = arrRelaciones(2).ToString
                p = 80 : columnaCombo.DisplayIndex = columna.DisplayIndex
                p = 90 : columnaCombo.Width = 80
                p = 100 : columnaCombo.DataMemberBinding = New Binding(arrRelaciones(2).ToString)     ' Primary Relation Field  ex: idCategoria
                p = 110 : columnaCombo.SelectedValueMemberPath = arrRelaciones(4).ToString            ' Secondary Relation Field  ex: idCategoria
                p = 120 : columnaCombo.DisplayMemberPath = arrRelaciones(5)                           ' Secondary Show data field  ex: nombreCategoria
     
              End If
            Next
            p = 200 : rgvRegistroTabla.Columns.Add(columnaCombo)
            ' La siguiente asignación dá el origen de datos al combo: Tipo de dato asignado: IEnumerable(Of IDictionary)
            ' Example:  Table: Categoria;    Fields: idCategoria, nombreCategoria
            p = 250 : DirectCast(rgvRegistroTabla.Columns(columnaCombo.UniqueName), GridViewComboBoxColumn).ItemsSource = GenerateData(tablaRel).ToDataSource
          End If
        End If
      Catch ex As Exception
        MessageBox.Show("Revisar: " & vbCrLf & m & p & vbCrLf & ex.Message)
      End Try
    End Sub

    for this example, the databound column idCategoria contains origin id data. The combobox column added don´t show "nombreCategoria" for each row, but if I click in the cell of combobox column, it show the combobox with data to relate, with fields idCategoria and nombreCategoria.

    How I find solution for this problem?

    thanks for any help

    Juan Pablo Díaz
    Bogotá D.C. - Colombia
  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 24 Jan 2011 Link to this post

    Hello Juan,

    You may take a look at this troubleshooting article in our online documentation.
     

    Best wishes,
    Maya
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  3. DevCraft banner
  4. kronnos_indigo
    kronnos_indigo avatar
    61 posts
    Member since:
    Jul 2006

    Posted 24 Jan 2011 Link to this post

    Good Morning Maya

    Thanks for your help, but, How I do to make this option dynamics in runtime by code behind VB.? The combobox column is add in runtime and this don´t exist in code XAML. The origin data so the relation data are also dynamics.

    Thanks for new help for this case.

    NOTE: if you see the code vb that y send in the post, I define the ItemSource of this combobox Column:

    DirectCast(rgvRegistroTabla.Columns(columnaCombo.UniqueName), GridViewComboBoxColumn).ItemsSource = GenerateData(tablaRel).ToDataSource

    This is the second option to solution case.

    Juan Pablo Díaz S,
    Bogotá D.C. - Colombia
  5. kronnos_indigo
    kronnos_indigo avatar
    61 posts
    Member since:
    Jul 2006

    Posted 25 Jan 2011 Link to this post

    Good afternoon Maya.

    I find the problem and solution then, I update the last version of Telerik SilverLigth and it run correctly.

    Thanks.

    JP.
Back to Top