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

DropDownList not functioning

3 Answers 144 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.
Donna Stewart
Top achievements
Rank 1
Donna Stewart asked on 27 Aug 2010, 09:32 PM
I am trying to use the DropDownList in a Telerik Window, but it isn't working and I have no idea what I am doing wrong.  I am using version 2010.2.825.  The input field displays for the dropdownlist with the first value in my list visible, but the field does not function as a dropdown.  I have looked at this with FireBug, but I can't figure out what is wrong.  I am fairly new to ASP.NET and jquery.  I know my list is there, I see it in the Model when I break on the code and I found this when looking at Locals:


innerHTML "

<SCRIPT type=text/javascript>

jQuery('#stateList').tDropDownList({data:[{"Text":"Alabama","Value":"AL"},{"Text":"Arizona","Value":"AZ"},{"Text":"Arkansas","Value":"AR"},{"Text":"California","Value":"CA"},{"Text":"Colorado","Value":"CO"},{"Text":"Connecticut","Value":"CT"},{"Text":"Delaware","Value":"DE"},{"Text":"District of Columbia","Value":"DC"},{"Text":"Florida","Value":"FL"},{"Text":"Georgia","Value":"GA"},{"Text":"Idaho","Value":"ID"},{"Text":"Illinois","Value":"IL"},{"Text":"Indiana","Value":"IN"},{"Text":"Iowa","Value":"IA"},{"Text":"Kansas","Value":"KS"},{"Text":"Kentucky","Value":"KY"},{"Text":"Louisiana","Value":"LA"},{"Text":"Maine","Value":"ME"},{"Text":"Maryland","Value":"MD"},{"Text":"Massachusetts","Value":"MA"},{"Text":"Michigan","Value":"MI"},{"Text":"Minnesota","Value":"MN"},{"Text":"Mississippi","Value":"MS"},{"Text":"Missouri","Value":"MO"},{"Text":"Montana","Value":"MT"},{"Text":"Nebraska","Value":"NE"},{"Text":"Nevada","Value":"NV"},{"Text":"New Hampshire","Value":"NH"},{"Text":"New Jersey","Value":"NJ"},{"Text":"New Mexico","Value":"NM"},{"Text":"New York","Value":"NY"},{"Text":"North Carolina","Value":"NC"},{"Text":"North Dakota","Value":"ND"},{"Text":"Ohio","Value":"OH"},{"Text":"Oklahoma","Value":"OK"},{"Text":"Oregon","Value":"OR"},{"Text":"Pennsylvania","Value":"PA"},{"Text":"Rhode Island","Value":"RI"},{"Text":"South Carolina","Value":"SC"},{"Text":"South Dakota","Value":"SD"},{"Text":"Tennessee","Value":"TN"},{"Text":"Texas","Value":"TX"},{"Text":"Utah","Value":"UT"},{"Text":"Vermont","Value":"VT"},{"Text":"Virginia","Value":"VA"},{"Text":"Washington","Value":"WA"},{"Text":"West Virginia","Value":"WV"},{"Text":"Wisconsin","Value":"WI"},{"Text":"Wyoming","Value":"WY"}]});

Here is the pertinent code:
The view with the link to the Telerik Window:

<%@ Control Language="VB" Inherits="System.Web.Mvc.ViewUserControl" %>
<div id="publicmaincontent" class="maincontentclass"
     style="background-image:url(<%=Model.mainContentImage%>); background-repeat:no-repeat;">
    <div id="maincontentright">
        <p class="publiccontentheader"><%= Model.mainContentTitle%></p>
        <p class="publiccontenttext"><%= Model.mainContentText%></p>
         <%  If Model.mainContentSubMenuList.Count > 0 Then %>
                <ul id="submenu">
                <% For Each MenuItem In Model.mainContentSubMenuList%>
                        <% If MenuItem.ActionName.Equals("ROI_study1") Then%>
                            <%= Html.ActionLink(MenuItem.Text, "roiCaseStudy", "SubContent", New With {.id = 1}, Nothing)%>
                        <% ElseIf MenuItem.ActionName.Equals("ROI_study2") Then%>
                            <%= Html.ActionLink(MenuItem.Text, "roiCaseStudy", "SubContent", New With {.id = 2}, Nothing)%>
                        <% Else %>
                            <%= Html.ActionLink(MenuItem.Text, "showSubContentPage", "SubContent", New With {.subAction = MenuItem.ActionName}, Nothing)%>
                        <% End If%>
                <%  Next %>
         <% End If%>
        <a href="#" id="popup">Open Telerik Window</a>
        <span id="salespopup" class="windows7">
            <%  Html.Telerik().Window().Name("Window") _
                .LoadContentFrom("salesRepresentatives", "Home") _
                .Buttons(Function(buttons) buttons.Refresh().Maximize().Close()) _
                .Draggable(True) _
                .Height(350) _
                .Width(450) _
                .Resizable() _
                .Visible(False) _
                .Title("Find Your Sales Representative") _
<%  Html.Telerik().ScriptRegistrar().OnDocumentReady("$('#popup').bind('click', function openWindow(e){ $('#Window').data('tWindow').open();})")%>
The partial view for the popup Telerik Window:
<%@ Control Language="VB" Inherits="System.Web.Mvc.ViewUserControl(Of IEnumerable (Of gmcps.StateItem))" %>
    <div  style="padding-left:10px; padding-top:15px;">
    Please choose a state:
    <%= Html.Telerik().DropDownList.Name("stateList") _
    .BindTo(New SelectList(Model, "stateId", "stateName"))%>
    <div id="salesRepInfo"></div>
The code from the controller:
Public Function salesRepresentatives() As ActionResult
    Dim salesStates As List(Of com.gmcps.CustInformation.Domain.WebInfo.web_GetSalesStatesResult) = WebInfoRepository.GetSalesStates()
    Dim salesStatesModel As New List(Of StateItem)
    For Each st In salesStates
        salesStatesModel.Add(New StateItem With {.stateName = st.StateName, .stateId = st.State})
    Return PartialView(salesStatesModel)
End Function
<%@ Master Language="VB" Inherits="System.Web.Mvc.ViewMasterPage" %>
<%-- The following line works around an ASP.NET compiler warning --%>
<%: ""%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
<head runat="server">
    <%: Ajax.GlobalizationScript()%>
    <title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title>
    <link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
    <%= Html.Telerik().StyleSheetRegistrar() _
                            .DefaultGroup(Function(group) group.Add("telerik.common.min.css")) _
                            .DefaultGroup(Function(group) group.Add("telerik.gmctelerik.css"))
        <asp:ContentPlaceHolder ID="MainContent" runat="server" />
    <%= Html.Telerik.ScriptRegistrar().Scripts(Function(s) s.Add("/2010.2.825/telerik.combobox.min.js")) _
                                              .Scripts(Function(s) s.Add("/curvycorners.js"))
Your help is very appreciated!!

3 Answers, 1 is accepted

Sort by
Georgi Krustev
Telerik team
answered on 29 Aug 2010, 08:44 AM
Hi Donna Stewart,

Check this forum thread. You can also review this help topic showing required client scripts.

Sincerely yours,
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Donna Stewart
Top achievements
Rank 1
answered on 30 Aug 2010, 03:35 PM
Yes that worked!  Thank you very much.  I had included telerik.dropdownlist.min.js when I was on the previous version, but got an error when I upgraded via the Telerik menu in VS 2010 (which is nice btw).  When I looked at the help doc that is included in the Telerik download, it still had telerik.dropdownlist.min.js listed as necessary.  Thank you again for your help!
Top achievements
Rank 1
answered on 01 Sep 2010, 07:25 PM
Hi Georgi Krustev,

Thanks for the answer. It helped.

Just for information, Why scriptregistrar is not adding these ( combobox, list ) scripts the way it does for others?

Asked by
Donna Stewart
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Donna Stewart
Top achievements
Rank 1
Top achievements
Rank 1
Share this question