We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

how to display multiple select dropdown on grid cell mouse click

Hi Team, 

I am new to syncfusion grid and unable to get help from the web for the multi select dropdown.

I am using GridGroupingControl which is derived from "Syncfusion.Windows.Forms.Grid.Grouping.GridGroupingControl gridGroupingControl1;" on windows form. This grid will have first row as blank which will be used by the user to add a new row.

Find attached the Grid screenshot.

I have a requirement where whenever "Execution Days" cell is clicked, then the multiple select drop down has to be shown similar to the one shown in the screenshot and whatever values user checked on the dropdown has to be assigned to that cell on button ok Click.

Please provide me some example or code for this.

Thanks,
Kazim



Syncfusiongridcontrol_8365a11.zip

13 Replies

VK Vinish Kumar K Syncfusion Team February 8, 2013 11:25 AM UTC

Hi Kazim,

 

Thank you for your interest in Syncfusion Products,

 

We have analyzed your query related to the drop down grid. Now currently we are working on this query. We will get back to you with proper details on February 11, 2013. In meantime you can customize your application based on the custom cell model which is available in GridControl. Just assign celltype to custom cell type with following

 

this.gridControl1[rowIndex, colIndex + 2].CellType = "DropDownForm";

            this.gridControl1[rowIndex, colIndex + 2].Text = "choice1,choice3";

 

 

Please refer the following sample from our dashboard from the following path

 

<installed path>\Syncfusion\EssentialStudio\<version>\Windows\Grid.Windows\Samples\2.0\Custom Cell Types\Drop Down Cell Demo\

 

Please let me know if you have further concerns,

Regards,

Vinish.



KA Kazim February 13, 2013 04:55 AM UTC

Hi,

Thanks for the code provided as it helped me to know which cell type to be used. I am using Syncfusion.Windows.Forms.Grid.Grouping.GridGroupingControl() and not the Grid control. I have achieved the drop down behaviour on the GridGroupingControl by using the below code.

private GridTableCellStyleInfo ggcStyle;
ggcStyle = gridGroupingControl1.TableDescriptor.Columns["ExecDays"].Appearance.AnyRecordFieldCell;
ggcStyle.CellType =
"DropDownForm";
this.daysCombo.Items.AddRange(new object[] {"Mon","Tue","Wed","Thu","Fri","Sat","Sun"});

Now the only problem is when I clicked on Ok button after selecting some values in the list, then that Grid cell is not getting those values assigned.

Please let me know how to assign the value to the GridGroupingControl cell on button OK click event.

Thanks & Regards,
Kazim



VK Vinish Kumar K Syncfusion Team February 13, 2013 11:38 AM UTC

Hi Kazim,

 

Thanks for your update.

 

We have analyzed your last update. We have tried to reproduce the issue in our end but I am afraid that I am unable to reproduce the issue in our end. Please provide the sample file which is you have used to select multi option combo box. This will help us to reproduce the issue in our end and provide an proper response and solution.

 

We will wait for your replay.

 

Regards,

Vinish.



KA Kazim February 28, 2013 09:57 AM UTC

Hi Team,

Find attached the sample project which is using the syncfusion gridgroupingcontrol along with the multi select checked list box.

 

I am not able to assign the values to the "Execution Days" cell whatever is selected from the checked list box on the button ok click. Particularly in the first row which is an empty one. Please let me know how to assign the selected values from the checked list box to the cell.

 

For example: The first row is empty. When clicked on the "Execution Days" cell, the multiselect drop down list will appear with all values unchecked. Now select any two values from the list and click on OK button. The selected value should be assigned to the first row "Execution Days" cell.

 

Thanks & Regards,

Kazim

 

 



SampleGridGroupingControl_4960cad5.zip


VK Vinish Kumar K Syncfusion Team February 28, 2013 11:45 AM UTC

Hi Kazim,

 

Thanks for your update.

 

We have deeply analyzed your sample with our source. We have found the issue in your sample. This issue is occur due to the sample level coding. Pease use the coding which is you have used in btnDaySelect_Click in btnSelectDay_Leave event. Please refer the following codes. W

 

private void daysCombo_Leave(object sender, EventArgs e)

        {

            //daysPanel.Visible = false;

 

            selectedDays.Clear();

            daysCombo.SelectedItems.Clear();

            var days = new string[7];

            daysCombo.CheckedItems.CopyTo(days, 0);

            foreach (var day in days)

            {

                if (!string.IsNullOrEmpty(day))

                    selectedDays.Append(day + ",");

            }

            daysPanel.Visible = false;

            if (selectedDays != null && selectedDays.Length > 0)

                selectedDays.Remove(selectedDays.Length - 1, 1);

        }

 

Please use above suggestion and let me know if this helps to you.

 

Regards,

Vinish



VK Vinish Kumar K Syncfusion Team February 28, 2013 11:45 AM UTC

Hi Kazim,

 

Thanks for your update.

 

We have deeply analyzed your sample with our source. We have found the issue in your sample. This issue is occur due to the sample level coding. Pease use the coding which is you have used in btnDaySelect_Click in btnSelectDay_Leave event. Please refer the following codes. W

 

private void daysCombo_Leave(object sender, EventArgs e)

        {

            //daysPanel.Visible = false;

 

            selectedDays.Clear();

            daysCombo.SelectedItems.Clear();

            var days = new string[7];

            daysCombo.CheckedItems.CopyTo(days, 0);

            foreach (var day in days)

            {

                if (!string.IsNullOrEmpty(day))

                    selectedDays.Append(day + ",");

            }

            daysPanel.Visible = false;

            if (selectedDays != null && selectedDays.Length > 0)

                selectedDays.Remove(selectedDays.Length - 1, 1);

        }

 

Please use above suggestion and let me know if this helps to you.

 

Regards,

Vinish



KA Kazim March 1, 2013 04:08 AM UTC

Hi Vinish,

Thanks for the update. My concern is only with the first row as for other rows it is working fine in my application. I have changed the coding as shown below as per your suggestion but still i am not getting the result for the first row. That is whenever some value are selected for the first row "Execution Days" column, then those values are not being assigned to that cell. Please help me to achieve this for the first row.

private void btnDaySelect_Click(object sender, EventArgs e)
{
daysPanel.Visible =
false;
}

private void daysCombo_Leave(object sender, EventArgs e)
{
     //daysPanel.Visible = false;
     
selectedDays.Clear();
     daysCombo.SelectedItems.Clear();
    
var days = new string[7];
     daysCombo.CheckedItems.CopyTo(days, 0);
    
foreach (var day in days)
     {
        
if (!string.IsNullOrEmpty(day))
         selectedDays.Append(day +
",");
     }
     daysPanel.Visible =
false;
     
if (selectedDays != null && selectedDays.Length > 0)
         
selectedDays.Remove(selectedDays.Length - 1, 1);
}

Thanks & Regards,
Kazim



KA Kazim March 1, 2013 04:13 AM UTC

Hi Vinish,

The first row in my previous reply refers to the first empty row.

Thanks & Regards,
Kazim



samplegridcontrolimage_5bc25d5c.zip


VK Vinish Kumar K Syncfusion Team March 5, 2013 11:52 AM UTC

Hi Kazim,

 

Thanks for your update.

 

We have deeply analyzed your query with the sample provide by you. The issue  is occur if the cell contain empty strings. For other cells the sample works properly. This issue may be occur due to the make of an cell value as null but not sure. Because we can’t able to reproduce in some time. So please let you check in your application is there any codes are used to remove the cell value either in designer or in any cell validation. The below lines in PrepareViewStyleInfo gives an empty value so please modify the method to get  selectedDays values

 

e.TableControl.Table.TableModel[e.Inner.RowIndex, 4].CellValue = selectedDays.ToString();

 

And let me know if this works for you else please let me know we will provide an proper response.

 

Regards,

Vinish.



KA Kazim March 6, 2013 08:34 AM UTC

Hi Vinish,

 

I removed the below line as you said but of no use.

 

e.TableControl.Table.TableModel[e.Inner.RowIndex, 4].CellValue = selectedDays.ToString();

 

I am posting the whole code again. Please check and help me to assign the selected values from the checked list drop down to the first cell of "Execution Days" column.

 

Thanks & Regards,

Kazim 



SampleGridGroupingControl_a11bb94b.zip


VK Vinish Kumar K Syncfusion Team March 7, 2013 07:16 PM UTC

Hi Kazim,

 

Sorry for the inconvenience caused.

 

Please ignore my previous update. I have suggested some solution for you in last update. And I have  analyzed the sample again and test the application again and again. I have found the issue is occur due to the following two reason.

 

1.       The combobox doesn’t works properly with the AddNewrecord row.

2.       The values are always null for this dropdown combo box column always.

So to avoid this issue I have found an simple work around for your application. This will gives an some efficient solution. Please refer the following highlighted codes.

 

private void daysCombo_Leave(object sender, EventArgs e)

        {

            //daysPanel.Visible = false;

            GridCurrentCell cc = this.gridGroupingControl1.TableControl.CurrentCell;

 

            selectedDays.Clear();

            daysCombo.SelectedItems.Clear();

            var days = new string[7];

            daysCombo.CheckedItems.CopyTo(days, 0);

            foreach (var day in days)

            {

                if (!string.IsNullOrEmpty(day))

                    selectedDays.Append(day + ",");

            }

            daysPanel.Visible = false;

            if (selectedDays != null && selectedDays.Length > 0)

                selectedDays.Remove(selectedDays.Length - 1, 1);

            if (cc.ColIndex == 4 && cc.RowIndex == 2)

                this.gridGroupingControl1.Table.AddNew();

        }

 

Please refer the attached sample file and let me know if this helps.

 

Regards,

Vinish.



SampleGridGroupingControl_767baf2b.zip


KA Kazim March 8, 2013 10:18 AM UTC

Hi Vinish,

 

Thanks a lot for the solution provided. It is working fine now.

 

Regards,

Kazim



VK Vinish Kumar K Syncfusion Team March 11, 2013 03:58 AM UTC

Hi Kazim,

 

Thanks for your update.

 

We are happy to hear about your issue is resolved. If you need any further assistance. Please open a new forum / incident. We will provide response quickly.

 

Regards,

Vinish.


Loader.
Live Chat Icon For mobile
Up arrow icon