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

Editing custom editor example

6 Answers 352 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 14 Dec 2012, 10:20 AM
I would like to see the complete functional code for the "Editing custom Editor" for Grid ,because something is missing there(in the online example).
there is a line:
columns.Bound(p => p.Employee).ClientTemplate("#=Employee.EmployeeName#");
but who is ("#=Employee.employeeName") and also is correct that syntax? .i supose it should be a template.but where it is?

I would like to add inside the grid also the Category of the product(which means a Dropdownlist with all the categories), just like in the example,but the code is for Order-Employee case.either way is still missing something there that template and how is bound to that list of that FK in our case, CategoryID.
Or again,if i can get an complete functional example for MVC(cshtml file and the code from the controller) with Northwind database just like in the online example.
Again i mention that in the \Program files(x86)\Telerik\Kendo UI for ASP.MVC there is NO \Examples folder with the examples,it would be nice to have all those examples,if they work.

thanks in advance.

6 Answers, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 18 Dec 2012, 09:57 AM
Hi Daniel,

 
Basically the offline examples which contains complete functional demo of "Grid Editing Custom Editor"
are located in different folder from the one that you mention:

  • ..\Telerik\Kendo UI for ASP.NET MVC %VERSION%\wrappers\aspnetmvc\Examples

 Also please note that the ClientTemplate method contains inline template and the Editor template is defined in the model using the UIHint attribute which contains the PartialView name:

Model:

[UIHint("ClientEmployee"), Required]
public ClientEmployeeViewModel Employee
{
    get;
    set;
}

ClientEmployee partial view:
@(Html.Kendo().DropDownList()
        .Name("Employee")
        .DataValueField("EmployeeID")
        .DataTextField("EmployeeName")
        .BindTo((System.Collections.IEnumerable)ViewData["employees"])
)
Kind Regards,
Vladimir Iliev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Daniel
Top achievements
Rank 1
answered on 19 Dec 2012, 07:43 AM
Hello,i managed to make it work the example,but with the local example installed from telerik control panel,the key was the clientTemplate was pointing to an EditorTemplate,which in the zipped example(sent at dropdownlist post)  wasn't there,and i didn't understand how  the view knows who is the employee from ClientTemplate.

Many thanks.
0
Vladimir Iliev
Telerik team
answered on 21 Dec 2012, 11:46 AM
Hi Daniel,

 
Please note that the ClientTemplate sets the template for that column and currently it renders property from the model. 

Kind Regards,
Vladimir Iliev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Daniel Knoll
Top achievements
Rank 1
answered on 02 Jan 2013, 01:54 PM
Hi,

I've also noticed the missing example on the online demo.

So please provide the ASP.NET MVC Code for populating a grid like it is shown in the demo. Currently the ASP.NET MVC Code shows how to populate a grid with Employee and ShipAddress, but the example shown is about Products and Category.

In particular I'm interested in how to load the Categories column like in the HTML version with a provided datasource. Currently I dont have the Method or Property "editor" like in the HTML version, where I can provide a Javascript Function to create the DropDownList.

In my scenario I need to populate a Dropdown (Foreign Key) in respect of a current selected filter, which is a DropDownList on the page above the Grid.

Greets
0
Daniel
Telerik team
answered on 04 Jan 2013, 02:14 PM
Hi,

The approach to define an editor template is different in MVC. Please check this documentation topic which provides information on this matter. 
As for filtering the dropdown based on an external input - you could use the following approaches:

  1. Use the Grid edit event to find the dropdown and filter it through its dataSource filter method
  2. Use remote binding for the dataSource and pass the value from the other dropdown through the DataSource Data function.
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
Daniel Knoll
Top achievements
Rank 1
answered on 07 Jan 2013, 10:31 AM
Hi,

thanks for your answer.

In the meantime, I've implemented following solution:

I created a template for the Navigation Property like in the tutorial you provided. In this template I set the DataSource of the DropDownList to my Remote DataSource and I pass the name of the JavaScript Function with the Data Property. This function exists in the page, where the Grid is shown. The control finds this function at runtime and passes the right data.

Maybe thats not the best solution, because I cannot ensure that the JavaScript Function exists, but it's definetly easier to implement.

Greets
Tags
Grid
Asked by
Daniel
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Daniel
Top achievements
Rank 1
Daniel Knoll
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or