Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Update 8/24</strong></p> <p>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:</p> <p><img src="https://i.stack.imgur.com/YpdFd.png" alt="Rad Controls Web Application"></p> <p>The modified Site.Master code looks like below:</p> <pre><code>&lt;%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %&gt; &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head runat="server"&gt; &lt;title&gt;&lt;asp:ContentPlaceHolder ID="TitleContent" runat="server" /&gt;&lt;/title&gt; &lt;link href="../../Content/Site.css" rel="stylesheet" type="text/css" /&gt; &lt;script src="../../Scripts/jquery-1.4.4.min.js" type="text/javascript"&gt;&lt;/script&gt; &lt;%: Html.Telerik().StyleSheetRegistrar().DefaultGroup(group =&gt; group.Add("telerik.common.css").Add("telerik.metro.css").Combined(true).Compress(true)) %&gt;&lt;/head&gt; &lt;body&gt; &lt;div class="page"&gt; &lt;header&gt; &lt;div id="title"&gt; &lt;h1&gt;My MVC Application&lt;/h1&gt; &lt;/div&gt; &lt;%: Html.Telerik().Menu() .Name("menu") .Items(menu =&gt; { menu.Add().Text("Home").Action("Index", "Home"); menu.Add().Text("About").Action("About", "Home"); }) %&gt; &lt;/header&gt; &lt;section id="main"&gt; &lt;asp:ContentPlaceHolder ID="MainContent" runat="server" /&gt; &lt;footer&gt; &lt;/footer&gt; &lt;/section&gt; &lt;/div&gt; &lt;%: Html.Telerik().ScriptRegistrar().DefaultGroup(group =&gt; group.Combined(true).Compress(true)) %&gt;&lt;/body&gt; &lt;/html&gt; </code></pre> <p>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.</p> <p>I have zipped up my code and uploaded to the following location :</p> <p><a href="http://sdrv.ms/T1EdBK" rel="nofollow noreferrer">http://sdrv.ms/T1EdBK</a></p> <p>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</p> <p>Hope this solves your problem</p> <hr> <p>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:</p> <pre><code>var dropDownList = $("#DropDownList").data("tDropDownList"); </code></pre> <p>Here is code snippet i was able to spin up for this scenario of yours:</p> <p>View:</p> <pre><code> &lt;%= Html.Telerik().DropDownList() .Name("courseID") .HtmlAttributes(new {@id="courseID" }) %&gt; &lt;input type="button" id="btnPopulateDropdown" onclick="onDropDownListDataBinding()" value="Populate Dropdown" /&gt; </code></pre> <p>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.</p> <p>JavaAcript:</p> <pre><code>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); } </code></pre> <p>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.</p> <p>This scenario is showcased in our online demo application page at the following URL: <a href="http://demos.telerik.com/aspnet-mvc/combobox/clientsidebinding" rel="nofollow noreferrer">http://demos.telerik.com/aspnet-mvc/combobox/clientsidebinding</a></p> <p>Hope this answers your question.</p> <p>Lohith (Tech Evangelist, Telerik India) </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload