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

Cannot show selected data in Combobox Column Cell

3 Answers 65 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 21 Jan 2011, 10:14 PM
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

3 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 24 Jan 2011, 08:37 AM
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>>
0
kronnos_indigo
Top achievements
Rank 2
answered on 24 Jan 2011, 03:31 PM
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
0
kronnos_indigo
Top achievements
Rank 2
answered on 25 Jan 2011, 08:52 PM
Good afternoon Maya.

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

Thanks.

JP.
Tags
GridView
Asked by
kronnos_indigo
Top achievements
Rank 2
Answers by
Maya
Telerik team
kronnos_indigo
Top achievements
Rank 2
Share this question
or