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

[Solved] Detail Grid EditorTemplate DropDownList

0 Answers 94 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.
Matthew
Top achievements
Rank 1
Matthew asked on 25 Jun 2012, 08:13 AM
This situation is a little complicated.

I have a Master-Detail Grid (all bound through ajax calls).  In the detail grid, I have an editortemplate that contains a dropdownlist.

When the dropdownlist is loaded, I try to access the data in the "onLoad" event shown below:

@{
    var conferences = NCAAController.GetConferences().OrderBy(c => c.Name);
}
 
<script type="text/javascript">
    function DropDownList_onLoad(e) {
        var ddl = $(this).data('tDropDownList');
    }
</script>
 
@(
    Html.Telerik().DropDownList()
        .Name("DropDownList")
        .BindTo(new SelectList(conferences, "ConferenceId", "Abbreviation"))
        .ClientEvents(events => events.OnLoad("DropDownList_onLoad"))
        .Placeholder("Conference...")
)

However, "ddl" is always undefined.  I tried it with 'tDropDown' as well to no avail.

And finally, I tried the ScriptRegistrar at the bottom of the EditorTemplate, but it caused some kind of Javascript syntax error.

Is it even possible to do what I'm trying to do?  Please help!  TIA
Tags
Grid
Asked by
Matthew
Top achievements
Rank 1
Share this question
or