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

GridDropdownColumn doesn't work as expected

6 Answers 242 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Javier
Top achievements
Rank 1
Javier asked on 23 Jun 2009, 07:22 PM
Hey everyone

I am using a radgrid and some GridDropDownColumns for displaying possible values when the user selects the edit command button. The problem is that the grid is displaying some values as it is supposed and others not, I am binding the grid programmatically at the code behind and sending a dataset with the values for the Master Table and for the drop down columns. The problem is only in the display, in edit mode the grid is working fine, I'm able to show the possible values in the columns as wondered.

here is the code...

aspx:

<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False"

        GridLines="None" MasterTableView-NoMasterRecordsText="No hay registros que mostrar">

        <MasterTableView DataKeyNames="ProductoId" Name="Productos" EditMode="InPlace">

        <Columns>

        <telerik:GridNumericColumn UniqueName="columnProductoId" HeaderText="ProductoId" DataField="ProductoId" Visible="false"></telerik:GridNumericColumn>

       

        <telerik:GridDropDownColumn UniqueName="columnTipoProducto"></telerik:GridDropDownColumn>

        <telerik:GridDropDownColumn UniqueName="columnPaisMoneda"></telerik:GridDropDownColumn>

        <telerik:GridDropDownColumn UniqueName="columnEstado"></telerik:GridDropDownColumn>

        <telerik:GridDropDownColumn UniqueName="columnOperador"></telerik:GridDropDownColumn>

       

        <telerik:GridBoundColumn UniqueName="columnDescripcion" HeaderText="Descripcion" DataField="Descripcion">

        </telerik:GridBoundColumn>

        <telerik:GridNumericColumn  UniqueName="columnValor" HeaderText="Valor" DataField="Valor">

        </telerik:GridNumericColumn>

       

        <telerik:GridDateTimeColumn UniqueName="columnFechaRegistro" HeaderText="Fecha de Registro" DataField="FechaRegistro">

        </telerik:GridDateTimeColumn>

        <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" EditText="Editar">

        </telerik:GridEditCommandColumn>

        <telerik:GridButtonColumn CommandName="Delete" ConfirmDialogType="RadWindow" ConfirmText="Está seguro de que desea eliminar este producto?" Text="Eliminar" UniqueName="DeleteColumn">

        </telerik:GridButtonColumn>

        </Columns>

            <RowIndicatorColumn>

                <HeaderStyle Width="20px" />

            </RowIndicatorColumn>

            <ExpandCollapseColumn>

                <HeaderStyle Width="20px" />

            </ExpandCollapseColumn>

        </MasterTableView>

    </telerik:RadGrid>

vb code behind:

Private Sub RadGrid1_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource

        Try

            Me.RadGrid1.DataSource = Me.FuenteDatosGrillaPinesProducto

            'here is where i send the dataset with all the DataTable               needed

            Me.RadGrid1.DataMember = "Tabla Pines Producto"

            Dim columna As GridDropDownColumn

 

            columna = Me.RadGrid1.Columns(1)

            With columna

                .DataSourceID = Me.RadGrid1.DataSourceID

                .HeaderText = "Tipo de producto"

                .DataField = "TipoProductoId"

                .ListTextField = "Descripcion"

                .ListValueField = "TipoProductoId"

                .DataSourceID = "Pines Productos"

                .ListDataMember = "Tabla Tipos Producto"

            End With

 

            columna = Me.RadGrid1.Columns(2)

            With columna

                .DataSourceID = Me.RadGrid1.DataSourceID

                .HeaderText = "Pais"

                .DataField = "PaisMonedaId"

                .ListTextField = "Descripcion"

                .ListValueField = "PaisId"

                .DataSourceID = "Pines Productos"

                .ListDataMember = "Tabla Paises"

            End With

 

            columna = Me.RadGrid1.Columns(3)

            With columna

                .DataSourceID = Me.RadGrid1.DataSourceID

                .HeaderText = "Estado"

                .DataField = "EstadoId"

                .ListTextField = "Descripcion"

                .ListValueField = "EstadoId"

                .DataSourceID = "Pines Productos"

                .ListDataMember = "Estados"

            End With

 

            columna = Me.RadGrid1.Columns(4)

            With columna

                .DataSourceID = Me.RadGrid1.DataSourceID

                .HeaderText = "Operador"

                .DataField = "OperadorId"

                .ListTextField = "Descripcion"

                .ListValueField = "OperadorID"

                .DataSourceID = "Pines Productos"

                .ListDataMember = "Tabla Operadores"

            End With

 

        Catch ex As Exception

 

        End Try

    End Sub

the result is something like this:
Tipo de producto   Pais            Estado                 Operador     Descripcion   Valor   Fecha Registro
PINEs                     Colombia    Producto Activo   Operador1   Pin de 500     500     13/03/2009
                                                                                                 Pin de 1000  1000    13/03/2009
PINEs                     Venezuela   Producto Activo   Operador1  Pin de 500     500     13/03/2009

as you can see the second row doesn't show anything on the columns that are grid drop down columns.

I don't know if you got the idea of my problem so far, thanks for your time

6 Answers, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 26 Jun 2009, 08:14 AM
Hello Javier,

Try setting the properties for the drop down columns in the page load event, as follows:

Protected Sub Page_Load(ByVal sender As ObjectByVal e As EventArgs)   
    If Not IsPostBack Then   
        Dim column As GridDropDownColumn = TryCast(RadGrid1.MasterTableView.GetColumn("columnTipoProducto"), GridDropDownColumn)   
        column.DataSourceID = "Pines Productos"   
        column.DataField = "TipoProductoId"   
        column.ListTextField = "Descripcion"              
        column.ListValueField = "TipoProductoId"   
        ....  
    End If   
End Sub  

I hope this helps.

Kind regards,
Tsvetoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Javier
Top achievements
Rank 1
answered on 26 Jun 2009, 09:32 PM
Hello again

First of all, I wan't to  thank you for the answer. I added the lines you proposed and when I debugged the project and followed the page load event the column already had the values you wanted to asign, and keeps having the same problem.
0
Accepted
Tsvetoslav
Telerik team
answered on 01 Jul 2009, 01:55 PM
Hi Javier,

Please, take a look at the attached sample and let us know of the result.

Thank you.

Regards,
Tsvetoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Javier
Top achievements
Rank 1
answered on 02 Jul 2009, 01:33 PM
Hi Tsvetoslav

It seems the problem is already solved, I just don't know why, but the grid is showing all the data as it should be. Anyway I want to thank you for your time.
0
Marc-Antoine
Top achievements
Rank 1
answered on 30 May 2012, 05:09 PM
Hi everyone,

I've the same problem ; in the display, data don't appears in the GridDropDownColumn. But in EditMode it works fine.
I've done exactly as the examples and I've tryed all of yours propositions but it still doesn't work.
Do you know why ?

Thank you,

Marc-Antoine.
0
Tsvetoslav
Telerik team
answered on 01 Jun 2012, 01:56 PM
Hi Javier,

Just upgrade to the latest version, download my sample in the previous post and run it. It should work all right.

Regards,
Tsvetoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Javier
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Javier
Top achievements
Rank 1
Marc-Antoine
Top achievements
Rank 1
Share this question
or