This question is locked. New answers and comments are not allowed.
I attempted to implement the Client Edit Templates solution from the demo projects in a new web project I created using 2001.2.825. I had the basic MVC project and I used the telerik tools to convert it to a Telerik project. I added the grid and started playing around and used the Ajax binding. Everything worked perfectly. I then added the following editor template:
And used the following grid definition:
Along with the following onEdit function:
No matter what, when I clicked the "edit" button on the grid the drop down list would be displaying the first item in the select list and would not respond to mouse clicks. After much searching, I realized that the functions needed were in telerik.list.min.js which was not being loaded.
On a whim, I added the following code directly to my index.aspx:
right above the grid and re-loaded the page.
The CityId1 DropDownList responded exactly as it should have. When I clicked the "Edit" button on the grid, the drop down list in the editor template responded properly and was properly databound!
So I have 2 questions: 1. How can I manually add the telerik.list.min.js file to the script registrar, and 2. Should I have to be doing this manually or *SHOULD* this be handled by the script registrar?
Thanks in advance!
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %><%@ Import Namespace="MassLeg.SourceData.AdminSite" %><%= Html.Telerik().DropDownList() .Name("CityId") .BindTo((SelectList)ViewData[ViewDataKeys.Cities])%>And used the following grid definition:
Html.Telerik().Grid<UserViewModel>() .Name("Grid") .DataKeys(keys => { keys.Add(u => u.UserId); }) .ToolBar(commands => commands.Insert().ButtonType(GridButtonType.Text).ImageHtmlAttributes(new { style = "margin-left:0" })) .DataBinding(dataBinding => dataBinding.Ajax() .Select("_SelectAjaxEditing", "User") .Insert("_InsertAjaxEditing", "User") .Update("_SaveAjaxEditing", "User") .Delete("_DeleteAjaxEditing", "User")) .Columns(columns => { columns.Bound(u=>u.UserId).Width(75); columns.Bound(u=>u.UserMemberCode).Width(100); columns.Bound(u => u.Prefix).Width(60); columns.Bound(u => u.FirstName).Width(90); columns.Bound(u => u.MiddleName).Width(70); columns.Bound(u => u.LastName).Width(90); columns.Bound(u => u.Suffix).Width(60); columns.Bound(u => u.Branch).Width(50); columns.Bound(u => u.District).Width(80); columns.Bound(u => u.CityId).Width(200); columns.Bound(u => u.Party).Width(60); columns.Bound(u => u.IsLegislator).ClientTemplate("<input type='checkbox' disabled='disabled' name='IsLegislator' <#=IsLegislator? checked='checked' : '' #>").Width(90); columns.Bound(u => u.IsActive).ClientTemplate("<input type='checkbox' disabled='disabled' name='IsActive' <#=IsActive? checked='checked' : '' #>").Width(90); columns.Command(commands => { commands.Edit().ButtonType(GridButtonType.Text); commands.Delete().ButtonType(GridButtonType.Text); }).Width(100).Title("Commands"); }) .ClientEvents(events => events.OnEdit("onEdit")) .Pageable() .Scrollable()Along with the following onEdit function:
function onEdit(e) { $(e.form).find('#CityId').data('tDropDownList').select(function (dataItem) { return dataItem.Value == e.dataItem['CityId'].toString(); }); }No matter what, when I clicked the "edit" button on the grid the drop down list would be displaying the first item in the select list and would not respond to mouse clicks. After much searching, I realized that the functions needed were in telerik.list.min.js which was not being loaded.
On a whim, I added the following code directly to my index.aspx:
<%= Html.Telerik().DropDownList() .Name("CityId1") .BindTo((SelectList)ViewData[ViewDataKeys.Cities])%>right above the grid and re-loaded the page.
The CityId1 DropDownList responded exactly as it should have. When I clicked the "Edit" button on the grid, the drop down list in the editor template responded properly and was properly databound!
So I have 2 questions: 1. How can I manually add the telerik.list.min.js file to the script registrar, and 2. Should I have to be doing this manually or *SHOULD* this be handled by the script registrar?
Thanks in advance!