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

Problem with kendo dropdownlist

7 Answers 255 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Goldfy
Top achievements
Rank 1
Goldfy asked on 07 Nov 2013, 09:01 AM
Hi: I have the following problem with my Kendo dropdownlist:
   In the model I pass to my view I have a list of Users, that I want to link to a dropdownlist called UsuariosDrpDwn
 and show it in a certain column("Usuario") of every row of my grid ( marked bold).
    
   I program the dropdownlist and it populates allright with the users, but when I link it to one of my grid's columns("Usuario"), the problem is it's values spread along the rows of the grid. Let's say my users are John, Martha, Grant, Michael. What happens is, John appears in the column "Usuario" of the first row, Martha in the column Usuario of the second row, Grant in the column Usuario of the third row, and Michael in the fourth.
      
   These is the code for the dropdownlist:

@(Html.Kendo().DropDownListFor(d=>d)
            .Name("UsuariosDrpDwn").HtmlAttributes(new { @style = "font-size:12px" })
            .DataTextField("NombreUsuario")
            .DataValueField("IdUsuario")
            .BindTo(Model)
            )
And this the code for my grid, I mark bold the column that is bounded to the dropdownlist:
        @(Html.Kendo().Grid(Model)
        .Name("Grid")
         .Columns(columns=>
          {
            columns.Bound(d => d.BorradoLogico).Title("Borrado logico");
            columns.Bound(d => d.FTick).Title("Ftick");
            columns.Bound(d => d.NombreUsuario).Title("Usuario").EditorTemplateName("UsersDrpDwn");
           @columns.Command(command => { command.Edit(); command.Destroy(); }).Width(172);
          })
   I attach my view.

7 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 07 Nov 2013, 02:30 PM
Hello,

 Could you please clarify what "the problem is it's values spread along the rows of the grid" means? A screenshot would help a lot.

Regards,
Atanas Korchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Goldfy
Top achievements
Rank 1
answered on 07 Nov 2013, 03:24 PM
As I show in the attached Image: the dropdownlist is the one appearing on the right top part of the image, with the name Usuarios( marked with a red circle) .
It's values are Alfonso(appears twice) and Juan (appears twice).

  The column of the grid where the values of the dropdownlist spread along is  called Usuario( marked with a red circle). As you can see in the photo, the users spread along the grid's rows. Alfonso in the first row of the grid, Alfonso again in the second row, then Juan in the third row of the grid, and again Juan in the fourth row . What I want is the dropdown to show in every cell Usuario of every row in the grid, being able to see all the users in it.
0
Atanas Korchev
Telerik team
answered on 07 Nov 2013, 04:17 PM
Hello,

The editor template will appear only when the current grid row is in edit mode. What happens when you click the edit button? Does the dropdown appear?

The only problem I see is that you are setting the name of the dropdownlist in the editor template. When you use DropDownListFor the name is set automatically. Here is how the updated code should look like:

@(Html.Kendo().DropDownListFor(d=>d)
            .DataTextField("NombreUsuario")
            .DataValueField("IdUsuario")
            .BindTo(Model)
            )

In addition you can check the following online demos: 
http://demos.kendoui.com/web/grid/editing-custom.html
http://demos.kendoui.com/web/grid/foreignkeycolumn.html

The help article about using editor templates could also be of help for you: http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/editor-templates

If you need further assistance please attach a runnable version of your project to this forum thread. We will troubleshoot it for you and see what went wrong.

Regards,
Atanas Korchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Goldfy
Top achievements
Rank 1
answered on 08 Nov 2013, 09:11 AM
Atanas your solution doesn't work as I show in the image. When you say runnable version , is it enough with a compressed version of my Project folder + the ddbb script?
0
Atanas Korchev
Telerik team
answered on 08 Nov 2013, 11:41 AM
Hi,

 A runnable version means a project which we can run at our side without any modifications or restoring database backups. 

Regards,
Atanas Korchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Goldfy
Top achievements
Rank 1
answered on 08 Nov 2013, 12:23 PM
is it enough with a compressed version of my Project folder + the ddbb script?
0
Atanas Korchev
Telerik team
answered on 08 Nov 2013, 12:45 PM
Hello,

 It would be enough if we can run your project without any modifications and reproduce the problem you are having. Of course we can't tell that before we have the files.

Regards,
Atanas Korchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
DropDownList
Asked by
Goldfy
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Goldfy
Top achievements
Rank 1
Share this question
or