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

[Solved] Inline Client Editing with Drowdown shows no Conent

0 Answers 81 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Frank Michael
Top achievements
Rank 1
Frank Michael asked on 08 Jan 2011, 01:03 PM
I have this Editor Template:

<%@ Control Language="C#" Inherits="AdaptiveWebRole.Views.SprintSelectionControl" CodeBehind="~/Views/Shared/EditorTemplates/SprintSelection.ascx.cs" %>
<% buildDropDown().Render(); %>

With this CodeBehind:

namespace AdaptiveWebRole.Views
{
    public class SprintSelectionControl : ViewUserControl<Sprint>
    {
        public DropDownListBuilder buildDropDown()
        {
            var viewDataSprints = ViewData["sprints"] as IEnumerable<Sprint>;
            var list = new List<Sprint>();
            list.Add(new Sprint {RowKey=String.Empty, Title="<none>"});
            viewDataSprints.ToList().ForEach(vds => list.Add(vds));
            var selectList = new SelectList(list, "RowKey", "Title");
 
            var dropDown =  Html.Telerik().DropDownList()
                      .Name("SprintModel")
                      .BindTo(selectList);
             
            return dropDown;
        }
    }
 
}

The selectList is filled correctly.

Additionally I have this script, that I have bound to the onEdit Event of the Grid:

function onEditWorkitemGrid(e) {
    var form = $(e.form);
    var sprintModel = form.find('#SprintModel');
    var data = sprintModel.data('tDropDownList');
    data.select(function (dataItem) {
        var text = dataItem.Text;
        var sprintModelContent = e.dataItem['SprintModel'];
        var result = text == sprintModelContent;
        return result;
    });
}

And this is the Model:

    public class WorkitemGridRow : Models.Workitem
    {
 
        public WorkitemGridRow(Workitem wi) : base(wi) { }
        public WorkitemGridRow() { }       
 
        [UIHint("SprintSelection")]
        public Models.Sprint SprintModel { get; set; }
 
        // etc.
}

The Drowdown shows to be very small and empty.

When I debug the java script it does not find the variable data. After the statement data is still null.

See screenshot.
Tags
Grid
Asked by
Frank Michael
Top achievements
Rank 1
Share this question
or