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

ListBox w/ checkbox element styling

1 Answer 114 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Rich
Top achievements
Rank 1
Rich asked on 16 Oct 2010, 09:19 PM
I have created RadListBox controls with checkboxes on a web page, but the styling of the rendered list elements shows the items on two lines, as in the attached graphic.  Here is the markup:

<

 

 

telerik:RadListBox ID="lstStandards" runat="server"

 

 

 

CssClass="RadListBox" CheckBoxes="true" Height="200" Width="200" />

 


How can I get the entries to display on one line per entry?

Several other listbox questions:

1. There are code examples of automatically checking the checkbox when a list item is selected, but I would like to see how the code should be called from the control.

2. How could I set the properterties of the control so that only the checkboxes can be used to select/unselect items?

Rich Sorensen

1 Answer, 1 is accepted

Sort by
0
Lenny_shp
Top achievements
Rank 2
answered on 19 Oct 2010, 03:13 PM
Are you using the latest version?   I don't have such problem.  It only wraps to 2 lines when listbox is shorter than the item.   Are there hidden spaces behind your value?

1.  add this to your listbox  OnClientSelectedIndexChanged="OnClientSelectedIndexChanged" 

        function OnClientSelectedIndexChanged(sender, args) {
            //for lstLegalReviewer to check item when selected
            var listbox = $find('<%= lstLegalReviewer.ClientID %>');
            var myItem = args.get_item()
            listbox.trackChanges();
            myItem.set_checked(!myItem.get_checked());
            listbox.commitChanges();
        }

2.  You would have to play with OnClientItemChecked or OnClientItemChecking event.   (avoid recursion)
Tags
ListBox
Asked by
Rich
Top achievements
Rank 1
Answers by
Lenny_shp
Top achievements
Rank 2
Share this question
or