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

Editing custom editor

2 Answers 126 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Nandan
Top achievements
Rank 1
Nandan asked on 20 Sep 2012, 12:47 PM

I am working with the good example of Editing custom editor under the MVC examples.
It shows how to build a dropdownlist for use when editing a cell in a grid.
I have to create a new post in the grid and I add the following to the file; Editing_Custom.cshtml:

.Create(create => create.Action("EditingCustom_Create", "Grid"))
.ToolBar(toolBar => { toolBar.Save(); toolBar.Create(); })

And I already get an error here before I come to do the coding in the .cs-file.
When debugging with firebug, I get an error from javascript that says: ReferenceError: EnrollTypes is not defined.
EnrollTypes is the class that is used for making the dropdownlist.
Could someone please give me a hint on what I have to do when creating a post in a grid with relational data?

I saw in some forum that Foregin key will sove this problem, but in my case there is no key column which can be named as foreign key. I just want to have a dropdown in grid column and it should also appear when I click on Add New Item button.  

Regards,
Nandan

2 Answers, 1 is accepted

Sort by
0
Nandan
Top achievements
Rank 1
answered on 24 Sep 2012, 07:20 AM
I am still waiting for this..............
0
Petur Subev
Telerik team
answered on 25 Sep 2012, 10:39 AM
Hi Nandan,

Most probably the insertion command in the toolbar fails because the default value(object) EnrollTypes is not defained.
You could try to specify it like this:
@(Html.Kendo().Grid<Person>().Name("persons")
            .DataSource(dataSource => dataSource
                .Ajax()
 
                    .Model(model =>
                    {
                        model.Id(m => m.PersonID);
                        model.Field(c => c.BirthDate).DefaultValue(new DateTime(2012, 12, 30));
                    })

I hope this helps.

All the best,
Petur Subev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Nandan
Top achievements
Rank 1
Answers by
Nandan
Top achievements
Rank 1
Petur Subev
Telerik team
Share this question
or