radmulticolumncombobox

12 posts, 0 answers
  1. Roya
    Roya avatar
    26 posts
    Member since:
    Jan 2012

    Posted 14 Apr 2012 Link to this post

    hi how can i edit  gridviewrow in radmuliticolumncombobox?
  2. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 19 Apr 2012 Link to this post

    Hello Roya,

    Thank you for writing.

    RadMultiColumnComboBox internally contains of RadGridView. It can be accessed from its EditorControl property. Here is a sample:
    radMultiColumnComboBox1.EditorControl.Rows[0].Cells["YourColumnName"].Value = someValue;

    I hope that you find this information useful. Let us know if you have any other questions.
     
    All the best,
    Stefan
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Roya
    Roya avatar
    26 posts
    Member since:
    Jan 2012

    Posted 19 Apr 2012 Link to this post

    Thank you Stefan for your reply
    your information was very good but  I have  3 columns in my multicolumncombobox,one of them is   check box column so i want to check & uncheck the chekboxes.
    please help me how can i do it?(I know there is checkbox dropdown list in rad controls but its hard for me to use it)



  5. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 21 Apr 2012 Link to this post

    Hello Roya,

    It does not matter how many columns you have in your RadMultiColumnComboBox, simply use the code snippet from my previous post to modify the desired cell value. Attached you can also find a sample project for your convenience. 

    Let us know if you need anything else.

    All the best,
    Stefan
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
  6. Roya
    Roya avatar
    26 posts
    Member since:
    Jan 2012

    Posted 21 Apr 2012 Link to this post

    Thank you Stefan for replying
    I want to press Space Key on the CheckBox column and change the status of it,

     public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();

                Random r = new Random();
                DataTable table = new DataTable();
                table.Columns.Add("ID", typeof(int));
                table.Columns.Add("Name", typeof(string));
                table.Columns.Add("Bool", typeof(bool));
                table.Columns.Add("DateColumn", typeof(DateTime));

                for (int i = 0; i < 10; i++)
                {
                    table.Rows.Add(i, "Row " + i, r.Next(10) > 5 ? true : false, DateTime.Now.AddHours(i));
                }

                radMultiColumnComboBox1.DataSource = table;
                radMultiColumnComboBox1.EditorControl.CellClick += new      Telerik.WinControls.UI.GridViewCellEventHandler(EditorControl_CellClick);

            }

            void EditorControl_CellClick(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e)
            {
                if (e.Column.Name == "Bool")
                ((DataGridViewCell)sender).Value = true;
            }

        }
  7. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 23 Apr 2012 Link to this post

    Hi Roya,

    Thank you for writing.

    In your code, you are trying to change the value of the check box when its cell is clicked. To do that, you need to cast to GridCheckBoxCellElement:
    void EditorControl_CellClick(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e)
    {
        if (e.Column.Name == "Bool")
            ((GridCheckBoxCellElement)sender).Value = !(bool)((GridCheckBoxCellElement)sender).Value;
    }

    In order to be able to change the check box by pressing the space key, you need to handle the KeyDown event of the text box, and do that manually. 

    Both approaches are implemented in the attached project. 

    I hope that you find this information useful.

    Kind regards,
    Stefan
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
  8. Roya
    Roya avatar
    26 posts
    Member since:
    Jan 2012

    Posted 26 Apr 2012 Link to this post

    Thank You Stefan
    I used your solution and this code to solve my problem,and I works.

    radMultiColumnComboBox1.EditorControl.CellBeginEdit += new GridViewCellCancelEventHandler(EditorControl_CellBeginEdit);

     void EditorControl_CellBeginEdit(object sender, GridViewCellCancelEventArgs e)
            {


    if (radMultiColumnComboBox1.EditorControl.CurrentColumn is GridViewCheckBoxColumn)
                {

                    RadCheckBoxEditor editor = (RadCheckBoxEditor)CmboBox.EditorControl.ActiveEditor;
                    editor.ValueChanged += new EventHandler(editor_ValueChanged);

                }
    }
  9. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 01 May 2012 Link to this post

    Hello Roya,

    I am glad that your case is resolved. Just one small suggestion, change your code to the following in order to avoid multiple subscriptions to the same event:
    void EditorControl_CellBeginEdit(object sender, GridViewCellCancelEventArgs e)
    {
                if (radMultiColumnComboBox1.EditorControl.CurrentColumn is GridViewCheckBoxColumn)
                {
                    RadCheckBoxEditor editor = (RadCheckBoxEditor)CmboBox.EditorControl.ActiveEditor;
                    editor.ValueChanged -= new EventHandler(editor_ValueChanged);
                    editor.ValueChanged += new EventHandler(editor_ValueChanged);
                }
    }

    If you have any other questions, do not hesitate to contact us.
     
    Regards,
    Stefan
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
  10. Roya
    Roya avatar
    26 posts
    Member since:
    Jan 2012

    Posted 02 May 2012 Link to this post

    thank you Stefan
     I have another question .I add this part to my project
    CmboBox.EditorControl.ReadOnly = false;
    CmboBox.EditorControl.KeyDown += new KeyEventHandler(EditorControl_KeyDown);

      void EditorControl_KeyDown(object sender, KeyEventArgs e)
            {

                    MessageBox.Show("EditorControl_KeyDown");
            }
    but the Key Down Event doesnt happen .Ill be thankfull if you cold help me
  11. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 04 May 2012 Link to this post

    Hello Roya,

    The event indeed is not fired since the focus is in the EditableArea. Here is how to capture it:
    radMultiColumnComboBox1.MultiColumnComboBoxElement.TextBoxElement.TextBoxItem.HostedControl.KeyDown += new KeyEventHandler(TextBoxElement_KeyDown);
     
    ...
    void TextBoxElement_KeyDown(object sender, KeyEventArgs e)
    {
    //do smth
    }

    If this does now work for you, please let me know what is your scenario, so I can help you further.

    Greetings,
    Stefan
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
  12. Amir
    Amir avatar
    1 posts
    Member since:
    Nov 2015

    Posted 24 Nov 2015 Link to this post

    can any one tell me that how can i store my value in radmultcolumncombobox  without data base like i have a Radmulticlumncombobox and i want to store in this  the names of week like sunday ,monday 

     

  13. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 25 Nov 2015 Link to this post

    Hello Amir,

    RadMultiColumnComboBox internally hosts RadGridView, which can be accessed via the EditorControl property. Once you get a reference to the grid, you can use its API to populate it with data manually. Here is an article on the matter: http://www.telerik.com/help/winforms/gridview-populating-with-data-unbound-mode.html

    Off topic, please try to separate the questions that are not related to each other in separate threads. We are trying to keep one subject per thread. Thank you for the understanding.

    Regards,
    Stefan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for WinForms is Visual Studio 2017 Ready