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

Listbox EmptyMessageTemplate rlbEmptyMessage positioning issue

2 Answers 51 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 18 Jun 2012, 05:29 PM
Hi I have the following aspx code:
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="TestWebApplication1._Default" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <telerik:RadListBox ID="RadListBox1" runat="server">
        <HeaderTemplate>
            Header
        </HeaderTemplate>
        <EmptyMessageTemplate>
            <asp:Label runat="server" Text="No Items"></asp:Label>
        </EmptyMessageTemplate>
    </telerik:RadListBox>
</asp:Content>


In my code behind:
RadListBox1.DataSource = new List<string> {};
RadListBox1.DataBind();

The telerik.web.ui.dll is
Version: 2011.3.1115.35
Runtime Version: v2.0.50727

The empty template get's renders like so: (see attachment)

I noticed that in the rendered HTML, there's a div with a class called "rlbEmptyMessage"
.RadListBox .rlbEmptyMessage {
    color: #999999;
    font-style: italic;
    position: absolute;
    text-align: center;
}

Now when I remove the position: absolute css style, the emtpy message displays as I think it should. Is this a bug?

Tested in Firefox 13.0 and and IE 8.0

2 Answers, 1 is accepted

Sort by
0
Accepted
Bozhidar
Telerik team
answered on 19 Jun 2012, 08:34 AM
Hi Brian,

The empty message template is intended to work with a ListBox which has a set height. Try setting the Height attribute of the ListBox and you will see that the empty message template is displayed accordingly. 

However, if you specifically don't want to set the height of the ListBox, you can apply the following css to your page, which resolves the issue:
.RadListBox .rlbEmptyMessage
{
    position: static !important;
}

 
Regards,
Bozhidar
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Brian
Top achievements
Rank 1
answered on 19 Jun 2012, 03:46 PM
Thanks Bozhidar, the css override worked exactly like I wanted.
Tags
ListBox
Asked by
Brian
Top achievements
Rank 1
Answers by
Bozhidar
Telerik team
Brian
Top achievements
Rank 1
Share this question
or