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

DropDownList not functioning

3 Answers 144 Views
ComboBox
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"}]});

</SCRIPT>
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%>
                    <li>
                        <% 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%>
                    </li>
                <%  Next %>
                </ul>
         <% 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") _
                .Render()
             %>
        </span>
    </div>
</div>
<%  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>
    <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})
    Next
    Return PartialView(salesStatesModel)
End Function
Site.Master
<%@ 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" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<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"))
    %>
</head>
  
<body>
    <div>
        <asp:ContentPlaceHolder ID="MainContent" runat="server" />
    </div>
    <%= Html.Telerik.ScriptRegistrar().Scripts(Function(s) s.Add("/2010.2.825/telerik.combobox.min.js")) _
                                              .Scripts(Function(s) s.Add("/curvycorners.js"))
    %>
</body>
</html>
Your help is very appreciated!!
Thanks,
Donna

3 Answers, 1 is accepted

Sort by
0
Accepted
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
0
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!
0
Jigar
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?

Thanks.
Jigar
Tags
ComboBox
Asked by
Donna Stewart
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Donna Stewart
Top achievements
Rank 1
Jigar
Top achievements
Rank 1
Share this question
or