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

DropDownList won't drop down

3 Answers 762 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 13 Jan 2017, 05:06 PM

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.

 

3 Answers, 1 is accepted

Sort by
0
John
Top achievements
Rank 1
answered on 16 Jan 2017, 05:08 PM
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.
0
Accepted
Peter Milchev
Telerik team
answered on 18 Jan 2017, 09:54 AM
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.
0
John
Top achievements
Rank 1
answered on 18 Jan 2017, 03:09 PM

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.

 

Tags
DropDownList
Asked by
John
Top achievements
Rank 1
Answers by
John
Top achievements
Rank 1
Peter Milchev
Telerik team
Share this question
or