多列选定的下拉列表未显示下拉列表值 [英] Multicolumn selected dropdownlist is not showing the dropdown values

查看:84
本文介绍了多列选定的下拉列表未显示下拉列表值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我在DropDownlist中使用了多列选择并且下拉列表没有打开



我尝试过:



Hi I have used multicolumn Select in DropDownlist and the dropdown list is not opening

What I have tried:

<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>

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();
        }

推荐答案

嘿Graeme,

项目模板部分在您的情况下为空。你能不能请看下面的按钮。

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>





您也可以查看此链接了解更多信息 Telerik ASP.NET ComboBox控件的演示 [ ^ ]


这篇关于多列选定的下拉列表未显示下拉列表值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆