DropDownList won't drop down

4 posts, 1 answers
  1. John
    John avatar
    5 posts
    Member since:
    Jan 2014

    Posted 13 Jan Link to this post

    Hello.  I have a form with two drop down lists, one to select a month and another to select a year.  However, I cannot get them to drop down so the user can make a selection.  I have checked to make sure they are enabled and that they have items.  What could be causing this?  The other fields on the form (text boxes and buttons) work just fine.

    Here is a snippet from my aspx file:

    <div class="row">
         <label class="col-md-3 text-right"><span class="required">*</span> Expiration Date</label>
         <div class="col-sm-9">
              <Telerik:RadDropDownList ID="ddlMonth" DefaultMessage="Month" CssClass="form-control forgotten_txt" runat="server" Width="135px" DropDownHeight="200px" DropDownWidth="135px"></Telerik:RadDropDownList>
              <asp:RequiredFieldValidator runat="server" ControlToValidate="ddlMonth" CssClass="alert-warning" ErrorMessage="(Required)" ValidationGroup="paymentprofile"></asp:RequiredFieldValidator>
              <Telerik:RadDropDownList ID="ddlYear" DefaultMessage="Year" CssClass="form-control forgotten_txt" runat="server" Width="135px" DropDownHeight="200" DropDownWidth="135"></Telerik:RadDropDownList>
              <asp:RequiredFieldValidator runat="server" ControlToValidate="ddlYear" CssClass="alert-warning" ErrorMessage="(Required)" ValidationGroup="paymentprofile"></asp:RequiredFieldValidator>
              <asp:Label ID="lblErrorMessage" runat="server" CssClass="alert-warning"></asp:Label>
         </div>
    </div>

    In the code behind during page load, the following routine populates the month drop down list.  A similar routine is used for the year list.

    Sub bindMonthDropdownlist()
        Dim item As DropDownListItem
        For month As Integer = 1 To 12
            item = New DropDownListItem()
            Dim monthName As String = Globalization.DateTimeFormatInfo.CurrentInfo.GetMonthName(month)
            item.Text = month.ToString("00") & " " & monthName
            item.Value = If(month < 10, "0" + month.ToString(), month.ToString())
            ddlMonth.Items.Add(item)
        Next
    End Sub

    The form is in a <div> that is initially hidden (visible="false").  I don't think that should make any difference, but I thought I should mention it.

    I have tried removing the required field validator, populating the drop box lists using a table, but nothing seems to work.

    Any suggestions would be greatly appreciated.

     

  2. John
    John avatar
    5 posts
    Member since:
    Jan 2014

    Posted 16 Jan in reply to John Link to this post

    I have spent over two days on this. I give up. A regular asp.net dropdownlist works, but not the Telerik version. I don't know what I am doing wrong or if there is a bug in this Telerik control in version 2016.3.1027.45, but I cannot waste any more time on this.  Very disappointing.
  3. Answer
    Peter Milchev
    Admin
    Peter Milchev avatar
    258 posts

    Posted 18 Jan Link to this post

    Hello John,

    To share with the community, from the submitted support ticket the issue turned out to be caused by a JavaScript error in custom JavaScript functions which prevented the proper behavior of the controls. Details for the JavaScript error could be found in the browser DevTools console.

    Regards,
    Peter Milchev
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  4. John
    John avatar
    5 posts
    Member since:
    Jan 2014

    Posted 18 Jan in reply to Peter Milchev Link to this post

    As Peter pointed out, the drop boxes would not drop down due to a bug in a javascript function.  Once I corrected the offending function, the drop box behaved correctly.

    Apparently bugs in javascript functions adversely affect Telerik controls, not just the drop down list control.  Rad text boxes on my form were also not behaving correctly - losing their values during post back.

    Thank you Peter for your help. I would not have thought to look for a problem in the javascript functions.

     

Back to Top