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

Grid template for edit (array[])

2 Answers 249 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gusev
Top achievements
Rank 1
Gusev asked on 10 Apr 2013, 01:23 PM
Hello!
I want  editing as here  http://www.kendoui.com/code-library/mvc/grid/using-multiselect-in-grid.aspx and 

I have Model:
public class ShrinkCoeffModel
    {
        [Display(Name = "thickness")]
        public virtual int Thickness { get; set; }
           
        [Display(Name = "wett")]
        public virtual string[] Wetness { get; set; }
   
        [Display(Name = "coeff")]
        public virtual decimal[] Coeff { get; set; }
    }
and Grid: (1.png)
@(
 Html.Kendo().Grid(Model)
                .Name("ShrinkCoeff")
                .ToolBar(commands =>
                {
                    commands.Create();
                })
                .Columns(columns =>
                {
                    columns.Bound(o => o.Thickness);
                    for (int i = 0; i < Model.FirstOrDefault().Wetness.Count(); i++)
                    {
                    columns.Bound(o => o.Wetness[i]);
                           
                    }
                    columns.Command(command =>
                    {
                        command.Edit();
                        command.Destroy();
                    }).Width(210).Title("Действия");
                })
                .Editable(editable => editable.TemplateName("Item").Mode(GridEditMode.PopUp))
                .DataSource(dataBinding => dataBinding
                    .Server()
                                                    .Model(model => model.Id(o => o.Thickness))
                                                        .Update("Edit", "ShrinkCoeff")
                                                        .Create("Create", "ShrinkCoeff")
                                                        .Destroy("Delete", "ShrinkCoeff"))
                .Pageable()
                .Sortable()
                .Selectable()
)
And if I click Edit I see this: 2.png 

But I want :

first Wetness             first Coeff                                                     
second Wetness      second Coeff  
.....                                  ......

how to display  also to and edit
how I can this do?

(I can pass my model to EditorTemplates and use:
@foreach(Type item in Model)
{
......) 
There are other ways?)

2 Answers, 1 is accepted

Sort by
0
Accepted
Daniel
Telerik team
answered on 12 Apr 2013, 01:12 PM
Hello Gusev,

You should create an editor template and specify that it should be used for the property by using the UIHint attribute. Please check this documentation topic for more detailed information on this matter.

Regards,
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Gusev
Top achievements
Rank 1
answered on 15 Apr 2013, 11:45 AM
Thanks!
Something I forgot about this method :(
Great Work!
Tags
Grid
Asked by
Gusev
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Gusev
Top achievements
Rank 1
Share this question
or