Listbox 'Transfer buttons' are always disabled

4 posts, 0 answers
  1. oren yona
    oren yona avatar
    3 posts
    Member since:
    Mar 2010

    Posted 20 Jul 2010 Link to this post

    Hi,

    I'm trying to simulate the transfer between listbox example
    (http://demos.telerik.com/aspnet-ajax-beta/listbox/examples/default/defaultcs.aspx),
    but I'm doing it programatically (the listboxes are inside a custom web server control, and are created and populated dynamically).
    everything works fine except that the transfer buttons are always disabled, no matter what I try to do.
    (I configured one of the list box to "allowTransfer=true" and the "TransferToListoxID" to the other list box's ID)
    I even tried the "AllowDrag" option, but when I drag items to the other listbox they just don't get transfered.

    What am I doing wrong?

    Thanks in advanced!

    Oren
  2. Tojara
    Tojara avatar
    7 posts
    Member since:
    Aug 2008

    Posted 21 Jul 2010 Link to this post

    I've done what you have described several times and I've never encountered such problem. Can you paste here you your codebehind code?
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. oren yona
    oren yona avatar
    3 posts
    Member since:
    Mar 2010

    Posted 21 Jul 2010 Link to this post

    Sure,
    Here's what I've done:

       
    public class FilterString : Panel, INamingContainer 
    RadWindow window = new RadWindow() {VisibleStatusbar=false, Skin = "Vista", Behaviors = WindowBehaviors.Close | WindowBehaviors.Move, Width = 390, Height = 400 }; 
    RadListBox radLstRight = new RadListBox() {AllowTransfer = true, SelectionMode = ListBoxSelectionMode.Multiple, TransferMode = ListBoxTransferMode.Move, Height = 170, Width = 150 ,Skin="Office2007"}; 
    RadListBox radLstLeft = new RadListBox() {SelectionMode = ListBoxSelectionMode.Multiple, TransferMode = ListBoxTransferMode.Move, Height = 170, Width = 180, Skin = "Office2007" };

    ...

    public void OpenFilter(DataTable dt, string columnName, string columnNameTran) 
    {
        FillStringList(dt, columnName);
        window.VisibleOnPageLoad = true
    }
      
    protected override void CreateChildControls() 
    {
        EnsureChildControls(); 
         ...
        // controls 
        radLstLeft.TransferToID = radLstRight.ID; 
        radLstRight.TransferToID = radLstLeft.ID;
        Table table = new Table() 
         {
            CssClass= "filtermenu_table"
             Rows = { new TableRow() { Cells = { new TableCell() { Controls = { lblHeader } }}}, 
                          new TableRow() { Cells = { new TableCell() { Controls = { radLstRight,radLstLeft}}}}, 
                new TableRow() {Cells = {new TableCell () {Controls = lblSearch, txtSearch,lkbSearch}}}}, 
                new TableRow() {Cells = {new TableCell() { Controls = lkbCut, lkbClose} }}}} 
            };
      
        window.ContentContainer.Controls.Add(table);
        this.Controls.Add(window);
        base.CreateChildControls();
    }
      
    ...
    private void FillStringList(DataTable dv, string colName) 
    {
        // I Manually Add Items to the listbox, because I want each Item to appear only once 
        (I couldn't do it using databind)
        radLstRight.Items.Clear();
        radLstLeft.Items.Clear();  
        List<string> items = new List<string>(); 
       foreach (DataRow item in dv.Rows) 
        {
        string value = item[colName].ToString(); 
        if (!items.Contains(value)) 
        items.Add(value);
        }
        
        foreach (string item in items) 
           radLstRight.Items.Add(new RadListBoxItem(item));
    }

     

    NOTE: 'Open filter' is called when a button is clicked on another custom web server control.

     

     

     

     

     

     

     

  5. oren yona
    oren yona avatar
    3 posts
    Member since:
    Mar 2010

    Posted 22 Jul 2010 Link to this post

    Just wanted to say that I solved the problem.
    Apparantly I forgot to specify an ID to the listboxes.

    everything works now!

    thanks,

    Oren
Back to Top