Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8459995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:29:01+00:00 2026-06-10T13:29:01+00:00

I am having issues with populating a telerik dropdown list using jquery. I get

  • 0

I am having issues with populating a telerik dropdown list using jquery. I get the following Error:

‘get(…).options’ is null or not an object

On line:

$(“#courseID”).get(0).options.length = 0;

Here is my telerik dropdown list:

                <%= Html.Telerik().DropDownList()
                .Name("courseID")
                .HtmlAttributes(new{ @id="courseID"})
                %>

Here is how I am trying to populate it using jquery:

I call the populateDDL function on “StudentID” focusout event, here is the function.

function populateDDL() {

var link = '/Student/EnrollerCourse';
$.ajax({
    type: 'POST',
    url: link,
    data: { id: $('#StudentId').val() },
    dataType: 'json',
    success: function (result) {
         $("#courseID").get(0).options.length = 0;
        $("#courseID").get(0).options[0] = new Option("Select", "Select");
        $.each(result.courseID, function (item, value) {
            var courseID = value;
            $("#courseID").get(0).options[$("#courseID").get(0).options.length] = new Option(courseID);
        });          
    },
    error: function (result) {
        alert("Failed")
    }
});
}

Any help is appreciated

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T13:29:02+00:00Added an answer on June 10, 2026 at 1:29 pm

    Update 8/24

    Sorry for the confusion. As i said – i had created a Visual C# – Web Project – of type “RadControls for Web Application”. Here is a screenshot:

    Rad Controls Web Application

    The modified Site.Master code looks like below:

    <%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>
    
    <!DOCTYPE html>
    <html>
    <head runat="server">
        <title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title>
        <link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
        <script src="../../Scripts/jquery-1.4.4.min.js" type="text/javascript"></script>
    <%: Html.Telerik().StyleSheetRegistrar().DefaultGroup(group => group.Add("telerik.common.css").Add("telerik.metro.css").Combined(true).Compress(true)) %></head>
    
    <body>
        <div class="page">
            <header>
                <div id="title">
                    <h1>My MVC Application</h1>
                </div>
                <%: Html.Telerik().Menu()
                        .Name("menu")
                        .Items(menu => {
                            menu.Add().Text("Home").Action("Index", "Home");
                            menu.Add().Text("About").Action("About", "Home");
                        })
                %>
            </header>
            <section id="main">
                <asp:ContentPlaceHolder ID="MainContent" runat="server" />
                <footer>
                </footer>
            </section>
        </div>
    <%: Html.Telerik().ScriptRegistrar().DefaultGroup(group => group.Combined(true).Compress(true)) %></body>
    </html>
    

    Notice that i added a JQuery reference through a script tag. That was the only change i did. Rest of the code stays as is.

    I have zipped up my code and uploaded to the following location :

    http://sdrv.ms/T1EdBK

    You can download the same and have a look at the code. You will need to set reference to Telerik.Web.Mvc.dll from you system

    Hope this solves your problem


    Telerik MVC Extension controls have a rich client side API. So if you have used a DropDownList – you will not be able to get the control by using the jquery syntax $(“#id”). Instead you will need to use the following:

    var dropDownList = $("#DropDownList").data("tDropDownList");
    

    Here is code snippet i was able to spin up for this scenario of yours:

    View:

     <%= Html.Telerik().DropDownList()
                          .Name("courseID")
                          .HtmlAttributes(new {@id="courseID" })
      %>
      <input type="button" id="btnPopulateDropdown" onclick="onDropDownListDataBinding()" value="Populate Dropdown" />
    

    So i have a drop down list defined with a name and id attributes. I have a button which is used to mimic your out of focus scenario. Idea is that on click of the button we will fire a AJAX request and get a JSON payload. we will use the JSON payload to bind the drop down list options.

    JavaAcript:

    function onDropDownListDataBinding(e) {
                    var dropDownList = $('#courseID').data('tDropDownList');
    
                    //Assume that we make a AJAX call and we have the JSON payload with us 
    
                    dropDownList.dataBind([
                                            { Text: "Select", Value: "Select"},
                                            { Text: "Product 1", Value: "1" },
                                            { Text: "Product 2", Value: "2" },
                                            { Text: "Product 3", Value: "3" },
                                            { Text: "Product 4", Value: "4" },
                                            { Text: "Product 5", Value: "5" },
                                            { Text: "Product 6", Value: "6" },
                                            { Text: "Product 7", Value: "7" },
                                            { Text: "Product 8", Value: "8" },
                                            { Text: "Product 9", Value: "9" },
                                            { Text: "Product 10", Value: "10" },
                                            { Text: "Product 11", Value: "11" },
                                            { Text: "Product 12", Value: "12" },
                                            { Text: "Product 13", Value: "13" },
                                            { Text: "Product 14", Value: "14" },
                                            { Text: "Product 15", Value: "15" },
                                            { Text: "Product 16", Value: "16" },
                                            { Text: "Product 17", Value: "17" },
                                            { Text: "Product 18", Value: "18" },
                                            { Text: "Product 19", Value: "19" },
                                            { Text: "Product 20", Value: "20" }
                                        ]);
                                            dropDownList.select(0);
                }
    

    As you can see the first line in the function is about getting a reference to the drop down list. Then assume that you made a AJAX request and you have got the JSON payload. You use the databind method to bind the JSON data. Then i use the select method to set the first option as the selection item in the drop down list.

    This scenario is showcased in our online demo application page at the following URL:
    http://demos.telerik.com/aspnet-mvc/combobox/clientsidebinding

    Hope this answers your question.

    Lohith (Tech Evangelist, Telerik India)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having issues populating a List of User defined object attributes in Struts2.
I am having issues populating a dropdown list with a JSON List. Here is
I'm having issues while populating a combobox using DirectStore, the combobox is as follow:
I'm having issues parsing some XML using DefaultHandler2. My XML takes the following form:
Having issues trying to select html injected into the DOM using jquery's load. Works
I am having issues with dynamically populating a select menu in jQuery mobile. When
Having issues trying to get this jquery code to work. The idea is that
Am having issues with printing different sized PDF's using GhostScript (V9.05). The PDF in
Im having issues getting this to work, maybe its not even possible? I have
I am having issues passing a dynamic parameter to a JavaScript function using innerHTML.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.