I am trying to generate a Telerik.Grid() PopUp with 4 dropdown menu's in them. Seleting a value in one dropdown shoud change the value in the other dropdown's.
I am using VS 2010, C# 4.0 and Telerik 2010.3.1110.235.
I am trying to implement the example provided http://demos.telerik.com/aspnet-mvc/grid/editingajax.
I am getting the following Javascript errors one after the other and I see the dropdown binding only to the first Item in the list. On Edit mode, I don't see any popup other than a very small box with Close 'X' on it.
- Microsoft JScript runtime error: Object doesn't support this property or method
- Microsoft JScript runtime error: 'find(...).data(...)' is null or not an object
- Microsoft JScript runtime error: 'parent().data(...)' is null or not an object
But the same works fine if I replace the Telerik.Dropdown with Html.DropDownList, but the width and look of the Dropdown is all messed up and I am not sure if this works fine for the built in functionalities if any, since it is not the build in one. But still I could see this Javascript error.
- Microsoft JScript runtime error: 'find(...).data(...)' is null or not an object
Model:
[
DisplayName("Id")]
[UIHint("SomeList"), Required]
public string City {get;set; }
View:
<%= Html.Telerik().Grid(Model.Name)
.Name("SomeList")
.DataKeys(keys =>
{
keys.Add(m => m.UniqueId);
})
.ToolBar(commands => commands.Insert().ButtonType(type).ImageHtmlAttributes(new {style="margin-left:0"}))
.DataBinding(dataBinding => {
dataBinding.Ajax()
.Select("_Select", "ControllerName")
.Insert("_Insert", "ControllerName")
.Update("_Save", "ControllerName")
.Delete("_Delete", "ControllerName");
})
.Columns(columns => {
columns.Bound(m => m.Id).Title("Id");
{Some more columns }
columns.Command(commands => {
commands.Edit().ButtonType(type);
commands.Delete().ButtonType(type);
}).Title("Action").Width(80);
})
.Editable(editing => editing.Mode(GridEditMode.PopUp))
.ClientEvents(events => events.OnEdit("onEdit"))
.Pageable()
.Scrollable(s => s.Height("100px"))
.HtmlAttributes(new { style = "width:545px" })
.Sortable()
%>
<script type="text/javascript">
function onEdit(e) {
$(e.form).find(
'#Id').data('tDropDownList').select(function (dataItem) {
return dataItem.Text == e.dataItem['Id']
});
}
ClientTemplates - SomeList.ascx
<%= Html.Telerik().DropDownList()
.Name("City")
.BindTo(new SelectList((IEnumerable)ViewData["CitiesItem"], "Value", "Text"))
Any help is greatly appreciated!
Thank you!