Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi I have used multicolumn Select in DropDownlist and the dropdown list is not opening

What I have tried:

ASP.NET
<telerik:RadComboBox RenderMode="Lightweight" runat="server" ID="RadComboBox2"  
            MarkFirstMatch="true"  EnableLoadOnDemand="true" AutoPostBack="true" OpenDropDownOnLoad="true"
            HighlightTemplatedItems="true" OnClientItemsRequested="UpdateItemCountField"
            
            OnDataBound="RadComboBox2_DataBound" OnItemDataBound="RadComboBox2_ItemDataBound"
            OnItemsRequested="RadComboBox2_ItemsRequested" DropDownCssClass="exampleRadComboBox">
            <HeaderTemplate>
                <ul>
                    <li class="col1">Name</li>
                    <li class="col2">Date</li>
                    <li class="col3">Gender</li>
                    <li class="col4">Location</li>
                </ul>
            </HeaderTemplate>
            <ItemTemplate>
                
            </ItemTemplate>
            <FooterTemplate>
                A total of
                <asp:Literal runat="server" ID="RadComboItemsCount" />
                items
            </FooterTemplate>
        </telerik:RadComboBox>
C#
protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
                Bind_ComboBox();
            }
        }
protected void RadComboBox2_DataBound(object sender, EventArgs e)
        {
           
            //((Literal)RadComboBox2.Footer.FindControl("RadComboItemsCount")).Text = Convert.ToString(RadComboBox2.Items.Count);
        }

        protected void RadComboBox2_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
        {
            
            SqlCommand cmd = new SqlCommand("SELECT * From Sampledb1 where [id]='" + ID + "'", cn);
            SqlDataAdapter da = new SqlDataAdapter(cmd);

            
            RadComboBox2.DataBind();
        }
        protected void RadComboBox2_ItemDataBound(object sender, RadComboBoxItemEventArgs e)
        {
           
            e.Item.Text = ((DataRowView)e.Item.DataItem)["Name"].ToString();
            e.Item.Value = ((DataRowView)e.Item.DataItem)["Id"].ToString();
        }
Posted
Updated 14-Mar-17 22:37pm
v3
Comments
Graeme_Grant 15-Mar-17 3:00am    
This is a Telerik question. Please use the Telerik forums: Telerik Developer Forums[^]
Sunasara Imdadhusen 15-Mar-17 3:35am    
can you please share screenshot of the page? so at-least we can see what it displaying!
Member 12605293 15-Mar-17 4:28am    
Hi Sunasara,How to share screen short here

1 solution

Hey Graeme,
Item template part is empty in your case. Can you please look into below snap.
<ItemTemplate>
<table style="width: 275px" cellspacing="0" cellpadding="0">
    <tr>
        <td style="width: 175px;">
            <%# DataBinder.Eval(Container, "Id")%>
        </td>
        <td style="width: 60px;">
            <%# DataBinder.Eval(Container, "Name")%>
        </td>
   </tr>
</table>
</ItemTemplate>


also you can check this link for more info Demos of Telerik ASP.NET ComboBox control[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900