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

EmptyMessageTemplate not showing correctly when show in Window

3 Answers 91 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Danny
Top achievements
Rank 1
Danny asked on 10 Apr 2012, 03:18 PM
Hi,

I'm having a problem where the text of the <EmptyMessageTemplate> is not centred correctly. My ListBox is inside a Window, which is not visible on the Initial load.

Markup
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="TestListBox.WebForm1" %>
 
<%@ 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">
</head>
<body>
  <form id="form1" runat="server">
  <telerik:RadScriptManager ID="scrpMngr" runat="server" AsyncPostBackTimeout="600">
  </telerik:RadScriptManager>
  <div>
    <telerik:RadWindow runat="server" ID="rdwWin" Height="320" Width="515" Behaviors="Close" Overlay="true" Modal="true" VisibleStatusbar="false" VisibleOnPageLoad="false" Visible="false">
      <ContentTemplate>
        <telerik:RadListBox runat="server" ID="lbSource" Height="200px" Width="260px" AllowTransfer="true" TransferToID="lbSelected" AllowTransferDuplicates="false" AllowTransferOnDoubleClick="true"
          TransferMode="Move" EnableDragAndDrop="true" ButtonSettings-Position="Right" TabIndex="1" AccessKey="y">
          <EmptyMessageTemplate>No items found</EmptyMessageTemplate>
        </telerik:RadListBox>
        <telerik:RadListBox runat="server" ID="lbSelected" Height="200px" Width="230px" AllowTransferOnDoubleClick="true" EnableDragAndDrop="true">
        <EmptyMessageTemplate>No items selected</EmptyMessageTemplate>
        </telerik:RadListBox>
      </ContentTemplate>
    </telerik:RadWindow>
    <asp:Button Text="Show window" runat="server" OnClick="btnShow_Click" />
  </div>
  </form>
</body>
</html>

CodeBehind
namespace TestListBox {
  public partial class WebForm1 : System.Web.UI.Page {
    protected void Page_Load(object sender, EventArgs e) {
      if (!Page.IsPostBack) {
        lbSource.Items.Add(new Telerik.Web.UI.RadListBoxItem() { Value = "1", Text = "some item" });
        lbSource.Items.Add(new Telerik.Web.UI.RadListBoxItem() { Value = "2", Text = "another item" });
      }
    }
 
    protected void btnShow_Click(object sender, EventArgs e) {
      rdwWin.Visible = true;
      rdwWin.VisibleOnPageLoad = true;
    }
  }
}

How to reproduce: Click "Show window" and you see that the 'no items selected' text is in the upperleft corner of the second ListBox. Move an item from the left to the right ListBox, and move it back to the left again. The 'no items selected' text show again, but now it's nicely centered in the ListBox.

Any idea how to solve this?

Thanks,
Danny

3 Answers, 1 is accepted

Sort by
0
Accepted
Genady Sergeev
Telerik team
answered on 13 Apr 2012, 02:18 PM
Hi Danny,

There seems to be a bug in RadListBox. I have logged it into our bug tracking system, meanwhile you can fix it using the following workaround:

1) Add handler for the OnClientShow event of RadWindow
2) Use this code there:

<script type="text/javascript">
  function show() {
      $find('<%= lbSelected.ClientID %>')._updateEmptyMessageVisibilty(); 
  }
 
</script>



Greetings,
Genady Sergeev
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
Danny
Top achievements
Rank 1
answered on 19 Apr 2012, 08:31 AM
Hi Genady,

Sorry my late response on this. You solution is working. Thans for this.

Any ideas when this bug will be resolved/fixed in de Telerik DLLs?

Thanks,
Danny
0
Dimitar Terziev
Telerik team
answered on 20 Apr 2012, 04:12 PM
Hello Danny,

The bug is fixed and should be available in the latest internal build which will be released next week.

All the best,
Dimitar Terziev
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.
Tags
ListBox
Asked by
Danny
Top achievements
Rank 1
Answers by
Genady Sergeev
Telerik team
Danny
Top achievements
Rank 1
Dimitar Terziev
Telerik team
Share this question
or