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

[Solved] Telerik MVC AutoComplete Microsoft JScript runtime error: 'Text' is null or not an object

0 Answers 61 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Alex
Top achievements
Rank 1
Alex asked on 12 Apr 2012, 03:03 PM
When I select an option from the drop down with my mouse or using the enter key I receive this error: Microsoft JScript runtime error: 'Text' is null or not an object. If I type out my selection I do not get the error. I am binding the data to the drop down using jquery.
What is causing this error and how can I fix it?
View:
columns.Bound(x => x.MaintenanceId)
                            .HeaderTemplate(@<text>Maint ID<br/>
                                @(Html.Telerik().AutoComplete()
                                     .Name("acGridMaintIDSelected")
                                     .ClientEvents(events => events.OnDataBinding("workOrderList.onAutoCompleteDataBinding"))              
                                     .Filterable(f => f.MinimumChars(3))
                                     .Encode(false)
                                     .AutoFill(true)
                                     .HtmlAttributes(new { @class = "wogridInputbox", style = "width:80px; height:16px" })
                                     .HighlightFirstMatch(true)
                                     .Multiple(m => m.Enabled(false))
                                )
                                </text>)
                            .ClientTemplate(Html.ActionLink("<#=MaintenanceId#>", "View", "ViewWorkOrder",                   
                            new { Area = "WorkOrders", id = "<#=WorkOrderId#>" }, null).ToHtmlString());
Js: (I only added the code that I thought was relevant)
(function (rite, workOrderList, $, undefined) {
    var $m = workOrderList;

$m.init = function () {

$m.onAutoCompleteDataBinding = function (e) {
 
        var autocomplete = $(this).data('tAutoComplete');
        var dataSource = [$(this).val()];
        autocomplete.dataBind(dataSource, true);
 
        var filterTypeAndValue = { 'filterType': $(this).attr('id'), 'filterValue': $(this).val() };
 
        rite.json({
            action: '_GridAutoCompleteAjaxLoading',
            controller: 'WorkOrderList',
            data: filterTypeAndValue,
            success: function (json) {
                autocomplete.dataBind(json, true);
            }
        });
    };
})(window.rite = window.rite || {}, window.workOrderList = window.workOrderList || {}, jQuery);


$(document).ready(function () {
    workOrderList.init();
});


Tags
General Discussions
Asked by
Alex
Top achievements
Rank 1
Share this question
or