This is a migrated thread and some comments may be shown as answers.
presetting the value of a comboboxx in a grid on insert
0 Answers 15 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jon
Top achievements
Rank 1
Jon asked on 06 Feb 2011, 10:20 PM
Does anybody know how to preset the value of a combobox on a grid when inserting a new row?

I'm doing this:
        function Grid_onEdit(e)
        {
            var mode = e.mode;
            var form = e.form;
 
            var PDate = $(form).find('#PDate');
            var ProjectID = $(form).find('#ProjectID');
            if (mode == 'insert') {
                PDate.val('2/1/11');
                $(e.form).find('#ProjectID').data('tComboBox').select(function (dataItem) {
                    return dataItem.Text == "3";
                });
            }
}
although I've tried numerous other things to get it to work. The PDate setting is working fine, but that's just a textbox field. 
The editor template looks like this (if it's any help):
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %>
 
<%= Html.Telerik().DropDownList()
        .Name("ProjectID")
        .BindTo(new SelectList((IEnumerable)ViewData["projects"], "ProjectID", "ProjectDescription"))
%>

Thanks.
Tags
General Discussions
Asked by
Jon
Top achievements
Rank 1
Share this question
or