"undefined" showing in empty DropDownList

4 posts, 0 answers
  1. Jacopo
    Jacopo avatar
    2 posts
    Member since:
    Oct 2010

    Posted 28 Oct 2010 Link to this post

    Hi,

    after adding the RadFormDecorator to my project MasterPage, I've noticed this strange behavior: in every DropDownList that doesn't have any element, the word 'undefined' is displayed.

    Here's a simple page that shows this behavior:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="DropDownList_undefined._Default" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form action="Default.aspx" runat="server">
            <telerik:RadScriptManager runat="server" id="sm1"></telerik:RadScriptManager>
            <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecoratedControls="all" />
             
            <asp:DropDownList runat="server" ID="ddlEmpty" Width="150px"></asp:DropDownList>
            <asp:DropDownList runat="server" ID="ddlPopulated" Width="150px">
                <asp:ListItem Text="Item1" Value="Item1"></asp:ListItem>
                <asp:ListItem Text="Item2" Value="Item2"></asp:ListItem>
            </asp:DropDownList>       
        </form>
    </body>
    </html>

    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
     
     
    namespace DropDownList_undefined
    {
        public partial class _Default : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
     
            }
        }
    }

    Is there any way to avoid this?

    Thanks
  2. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 01 Nov 2010 Link to this post

    Hello Jacopo,

    Could you please, explain your scenario in more detail and provide information why do you want to render an empty dropdownlist on the page?

    According to the UX rules and recommendations it is not good to load empty dropdowns on the page. If you want to load items dynamically in the empty dropdown, than our suggestion is to load the dropdownlist control disabled:
    <asp:DropDownList runat="server" ID="ddlEmpty" Width="150px" Enabled="false"></asp:DropDownList>

    Once you add an item to the dropdown, just enable it.


    Greetings,
    Rumen
    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jacopo
    Jacopo avatar
    2 posts
    Member since:
    Oct 2010

    Posted 02 Nov 2010 Link to this post

    Hi Rumen and thanks for your answer.
    sometimes I need to load empty dropdowns in my pages. Just as an example think of a State/City selection scenario: at the PageLoad only the State dropdown is populated and after a user chooses the state, the City dropdown items are loaded.
    Unfortunately we have tens of forms that behave this way in our application and it is really troublesome to have the 'undefined' word showing when the dropdowns are loaded. This is even more annoying since it seems that there is no way to localize or remove the text.

    Besides, I've also tried to set the Enabled property to false like you suggested and, even if the dropdownlist is disabled and greyed out, the word 'undefined' is still there!

    Maybe I can try to override this behavior if I know which script set the undefined word. Would it be possible for you to give me some suggestions about this?

    Thanks for your help
  5. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 04 Nov 2010 Link to this post

    Hello Jacopo,

    We can't provide a workaround at this point, but I logged this problem as a bug in our database and we will do our best to fix it for one of the following updates.
    You can track the progress on this issue by checking its PITS Public URL

    Sincerely yours,
    Georgi Tunev
    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
Back to Top