EmptyMessageTemplate not showing correctly when show in Window

4 posts, 1 answers
  1. Danny
    Danny avatar
    29 posts
    Member since:
    Feb 2012

    Posted 10 Apr 2012 Link to this post

    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
  2. Answer
    Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 13 Apr 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Danny
    Danny avatar
    29 posts
    Member since:
    Feb 2012

    Posted 19 Apr 2012 Link to this post

    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
  5. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1266 posts

    Posted 20 Apr 2012 Link to this post

    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.
Back to Top