Multi-column Combobox Problem (can't selected item)

4 posts, 0 answers
  1. shunman
    shunman avatar
    77 posts
    Member since:
    Jul 2011

    Posted 29 May 2012 Link to this post

    Hello Telerik Team.

    I faced with a problem about Multi-column Combobox selection.
    I tried combobox binding like below.  It doesn't work fine.

    Selected combobox item is not shown on the box.
    I want to select located 2nd item. but still shown "System.Data.DataRowView" text

    please let me know how can i  solve this problem

    thanks you.
    <%@ Page Language="VB" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="RadControlsWebApp1._Default" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <head runat="server">
        <telerik:RadStyleSheetManager id="RadStyleSheetManager1" runat="server" />
        <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
                <%--Needed for JavaScript IntelliSense in VS2010--%>
                <%--For VS2008 replace RadScriptManager with ScriptManager--%>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
        <script type="text/javascript">
            //Put your JavaScript code here.
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <telerik:RadComboBox runat="server" ID="RadComboBoxProduct" TabIndex="13" Width="100%"
            HighlightTemplatedItems="true" EnableEmbeddedSkins="true" >
                                                <li class="col1">Product </li>
                                                <li class="col2">Product Status </li>
                                                <li class="col1">
                                                    <asp:Label runat="server" ID="RadComboBoxItemProduct"></asp:Label>
                                                <li class="col2">
                                                    <asp:Label runat="server" ID="RadComboBoxItemProductStatus"></asp:Label>

    Private Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
            Dim datatable As New DataTable()
            datatable.Rows.Add("11396", "ddddd", "Inhouse")
            datatable.Rows.Add("23742", "ereeee", "Died")
            datatable.Rows.Add("2302", "oewjhf", "Dead")
            datatable.Rows.Add("0928", "ddddd", "Cutted")
            RadComboBoxProduct.DataSource = datatable
        End Sub
        Protected Sub RadComboBoxProduct_ItemDataBound(sender As Object, e As Telerik.Web.UI.RadComboBoxItemEventArgs) Handles RadComboBoxProduct.ItemDataBound
            Dim labelProduct = DirectCast(RadComboBoxProduct.Items(e.Item.Index).FindControl("RadComboBoxItemProduct"), Label)
            Dim labelProductStatus = DirectCast(RadComboBoxProduct.Items(e.Item.Index).FindControl("RadComboBoxItemProductStatus"), Label)
            labelProduct.Text = e.Item.DataItem("ProductName")
            labelProductStatus.Text = e.Item.DataItem("CodeName")
            e.Item.Value = e.Item.DataItem("FirmProductNo")
        End Sub
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 29 May 2012 Link to this post

    Hi Shunman,

    After inspecting your code I found that you are not setting e.Item.Text of RadComboBox. Please try the following code snippet in ItemDataBound event of RadComboBox.

    Protected Sub RadComboBoxProduct_ItemDataBound(sender As Object, e As Telerik.Web.UI.RadComboBoxItemEventArgs)
        Dim labelProduct As Label = DirectCast(RadComboBoxProduct.Items(e.Item.Index).FindControl("RadComboBoxItemProduct"), Label)
        Dim labelProductStatus As Label = DirectCast(RadComboBoxProduct.Items(e.Item.Index).FindControl("RadComboBoxItemProductStatus"), Label)
        labelProduct.Text = DirectCast(e.Item.DataItem, DataRowView)("ProductName").ToString()
        labelProductStatus.Text = DirectCast(e.Item.DataItem, DataRowView)("CodeName").ToString()
        e.Item.Value = DirectCast(e.Item.DataItem, DataRowView)("FirmProductNo").ToString()
        e.Item.Text = DirectCast(e.Item.DataItem, DataRowView)("CodeName").ToString()
    End Sub

    Hope this helps.

  3. shunman
    shunman avatar
    77 posts
    Member since:
    Jul 2011

    Posted 29 May 2012 Link to this post

    Hello Princy.

    Thank you for  helping.

    Your codes are very work fine. thank you.

  4. Aprajita
    Aprajita avatar
    2 posts
    Member since:
    Sep 2014

    Posted 25 Sep 2014 Link to this post

    Please check the pic attached..I want this kind of layout in Jquery if posssible...
Back to Top