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

Mulit Column for one field

2 Answers 41 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Laura
Top achievements
Rank 1
Laura asked on 19 Nov 2008, 02:38 PM
I have a combo box for one field - providers. There is a list of 264 providers. I don't want the user to have to scroll down through 264 items, and would like to display it in 3 columns and the user can go down or across to chose the provider. Is this possible using a combo box?

Thanks,
Laura

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 20 Nov 2008, 10:32 AM
Hi Laura,

One suggestion to achieve this scenario is that, add one DataList as ItemTemplate of RadComboBox, then call the JavaScript function for setting the text of RadComboBox. Try the below codes.

ASPX:
<telerik:RadComboBox ID="RadComboBox1" Runat="server" OnClientSelectedIndexChanged="dropdownclosed" OnClientDropDownClosed="dropdownclosed" > 
        <ItemTemplate> 
        <asp:DataList id="repeater" runat="server" RepeatColumns="3"  
            RepeatDirection="Vertical" DataSourceID="SqlDataSource1"  
            onselectedindexchanged="repeater_SelectedIndexChanged" > 
            <ItemTemplate> 
            <table> 
                <tr> 
                <td> 
                    <label  onclick="click_label('<%# DataBinder.Eval(Container.DataItem,"Name") %>'); return false;"
                        <%# DataBinder.Eval(Container.DataItem,"Name") %> 
                    </label> 
                </td> 
                </tr> 
            </table> 
            </ItemTemplate> 
        </asp:DataList> 
        </ItemTemplate>         
        <Items> 
            <telerik:RadComboBoxItem></telerik:RadComboBoxItem> 
        </Items> 
</telerik:RadComboBox> 
<asp:SqlDataSource ID="SqlDataSource1" runat="server"  
            ConnectionString="<%$ ConnectionStrings:TestConnectionString %>"  
            SelectCommand="SELECT [Name] FROM [States]"
</asp:SqlDataSource>   

JavaScript:
<script type="text/javascript"
var selecteditem; 
function click_label(variable) 
    selecteditem=String(variable); 
function dropdownclosed() 
    var combo = $find("<%= RadComboBox1.ClientID %>"); 
    combo.set_text(String(selecteditem)); 
</script> 


Regards,
Shinu.
0
Laura
Top achievements
Rank 1
answered on 20 Nov 2008, 03:53 PM
Thank you Shinu. When I try to implement this in t the radcombo box, when I have a list of 264 items, the page takes too long to load, and when I use a combo box that has over 1000 items, I get an out of memory error.

How would be the best way to have the user choose from such a large list of items?

Thanks,
Laura
Tags
ComboBox
Asked by
Laura
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Laura
Top achievements
Rank 1
Share this question
or