MultiColumn in Display

7 posts, 0 answers
  1. Boris
    Boris avatar
    1 posts
    Member since:
    Apr 2014

    Posted 05 Apr 2014 Link to this post

    Hi

    How to do i Display multiple fields in Display/Select Box?

    Basically  is there way do display selected row, instead of just one filed Selected Filed

    Thank you.
  2. Dess
    Admin
    Dess avatar
    2164 posts

    Posted 09 Apr 2014 Link to this post

    Hello Boris,

    Thank you for writing.

    If I understand your requirement correctly, you are trying to display the multiple cell values from the currently selected row in the popup grid inside the editable part of the RadMultiColumnComboBox. This functionality is not supported our of the box.

    The multi-column combobox is a special case of combobox control with RadGridView integrated in its drop-down. The control combines the functionality and features of RadComboBox and RadGridView. According to the DisplayMember property, you are allowed to display only one cell value according to the current selection. You can customize the default behavior and display several values in the text area via custom MultiColumnComboGridBehavior.  Here is a sample code snippet, demonstrating how to achieve it:
    private void Form1_Load(object sender, EventArgs e)
    {
        this.productsTableAdapter.Fill(this.nwindDataSet.Products);
         
        this.radMultiColumnComboBox1.MultiColumnComboBoxElement.EditorControl.CurrentRowChanged += EditorControl_CurrentRowChanged;
        this.radMultiColumnComboBox1.MultiColumnComboBoxElement.EditorControl.GridBehavior = new CustomMultiColumnComboGridBehavior();
        this.radMultiColumnComboBox1.DataSource = this.productsBindingSource; 
    }
     
    private void EditorControl_CurrentRowChanged(object sender, Telerik.WinControls.UI.CurrentRowChangedEventArgs e)
    {
        StringBuilder sb = new StringBuilder();
        foreach (GridViewCellInfo cell in e.CurrentRow.Cells)
        {
            sb.AppendFormat("{0} | ", cell.Value);
        }
        radMultiColumnComboBox1.MultiColumnComboBoxElement.Tag = sb.ToString();
        radMultiColumnComboBox1.MultiColumnComboBoxElement.Text = sb.ToString();
    }
     
    public class CustomMultiColumnComboGridBehavior : MultiColumnComboGridBehavior
    {
        public override bool OnMouseUp(MouseEventArgs e)
        {
            bool result = base.OnMouseUp(e);
     
            MultiColumnComboPopupForm popupForm = this.GridViewElement.ElementTree.Control.Parent as MultiColumnComboPopupForm;
            RadMultiColumnComboBoxElement multiComboBoxElement = popupForm.OwnerElement as RadMultiColumnComboBoxElement;
            if (multiComboBoxElement.Tag != null && multiComboBoxElement.Text != multiComboBoxElement.Tag)
            {
                multiComboBoxElement.Text = multiComboBoxElement.Tag.ToString();
                multiComboBoxElement.Tag = null;
            }
             
            return result;
        }
    }

    I hope this information helps. Should you have further questions, I would be glad to help.

    Regards,
    Desislava
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. fabrizio
    fabrizio avatar
    8 posts
    Member since:
    Aug 2010

    Posted 12 May in reply to Dess Link to this post

    Hi Dess
    I was also looking for a way to show more cells in the text field of the radMulticolumn combo.

    I use vb.net and do not understand how to translate the code

    "This.radMultiColumnComboBox1.MultiColumnComboBoxElement.EditorControl.CurrentRowChanged + = EditorControl_CurrentRowChanged;"

    From c # to vb.net.
    Can you help me please?
    Thank you
    Fabrizio

  4. Dess
    Admin
    Dess avatar
    2164 posts

    Posted 16 May Link to this post

    Hello Fabrizio, 

    Thank you for writing.  

    In order to subscribe to the CurrentRowChanged event in VB.NET, you can use the following code snippet:  
    Sub New()
        InitializeComponent()
        AddHandler Me.RadMultiColumnComboBox1.MultiColumnComboBoxElement.EditorControl.CurrentRowChanged, AddressOf CurrentRowChanged
    End Sub
     
    Private Sub CurrentRowChanged(sender As Object, e As Telerik.WinControls.UI.CurrentRowChangedEventArgs)
        'TODO
    End Sub

    I hope this information helps. Should you have further questions I would be glad to help.

    Regards,
    Dess
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  5. fabrizio
    fabrizio avatar
    8 posts
    Member since:
    Aug 2010

    Posted 18 May in reply to Dess Link to this post

    Hello Dess thank you so much for your code, works fine on the currentRowChanged event.
    Sorry I wanted to ask if is possible to show more cells in the text even during the on_load form event ?
    With the Visual Studio Combobox I was concatenating the columns with a cycle for each, but with the MultiColumnComboBox I can not figure out how to do it and if it can be done.
    Thank you
    Fabrizio

     

  6. Dess
    Admin
    Dess avatar
    2164 posts

    Posted 19 May Link to this post

    Hello Fabrizio, 

    Thank you for writing back. 

    If I understand your requirement correctly, you are trying to display more than one fields in the editable part of RadMultiColumnComboBox. Note that the DisplayMember property controls what to be displayed. But it is designed to specify only one field. The possible solution that I can suggest is to create an additional field that will store the concatenated data and use that field as DisplayMember. Here is a sample code snippet: 
    Dim dt As New DataTable
    dt.Columns.Add("Id", GetType(Integer))
    dt.Columns.Add("Name", GetType(String))
    dt.Columns.Add("ConcatenatedField", GetType(String))
    For index = 1 To 10
        dt.Rows.Add(index, "Item" & index, index & "Item" & index)
    Next
    Me.RadMultiColumnComboBox1.DataSource = dt
    Me.RadMultiColumnComboBox1.DisplayMember = "ConcatenatedField"
    Me.RadMultiColumnComboBox1.ValueMember = "Id"
    Me.RadMultiColumnComboBox1.EditorControl.Columns("ConcatenatedField").IsVisible = False

    If it is not the exact requirement, please specify in details what is the exact requirement that you are trying to achieve. Thus, we would be able to think about a suitable solution and assist you further.

    I hope this information helps. If you have any additional questions, please let me know. 

    Regards,
    Dess
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  7. fabrizio
    fabrizio avatar
    8 posts
    Member since:
    Aug 2010

    Posted 19 May Link to this post

    Hello DESS

    Your solution is perfect. Thank You very much

Back to Top