In my grid i have three drop down columns. When the grid is closed, the layout is saved to a file and retrieved on grid open.
But the grid save layout messes up with the drop down columns, it just takes the first dropdown column values and populates on other two drop down also.
If I remove the save layout option, the grid works fine. But I loose the good save layout feature
Hi,
I've never heard of that happening before. I've used the save and load feature of the grid many times with grids that have several dropdowns and never had a problem like that.
My guess is that something in your InitializeLayout event code is doing something to alter the dropdowns, or perhaps you are assigning editors to the grid columns and using the same editor for multiple columns. It's hard to guess.
Of course, I could be wrong, perhaps this is an obscure bug that only occurs with certain property setting combinations.
Can you reproduce this in a small sample project so we can check it out?
Here is my code
Private Sub ultraGrid1_InitializeLayout(ByVal sender As Object, ByVal e As InitializeLayoutEventArgs) Handles UltraGrid1.InitializeLayout
Me.vendors = New VendorList(True).VendorNames
Me.vendorDropDown = New UltraDropDown()
Me.vendorDropDown.DisplayLayout.Override.CellAppearance.BackColor = Color.LightGreen
Me.vendorDropDown.SetDataBinding(vendors, "")
Me.Controls.Add(vendorDropDown)
e.Layout.Bands(0).Columns("VendorName").ValueList = vendorDropDown
Me.departments = New DepartmentList(True).Departments
Me.departmentDropDown = New UltraDropDown()
Me.departmentDropDown.DisplayLayout.Override.CellAppearance.BackColor = Color.LightYellow
Me.departmentDropDown.SetDataBinding(departments, "")
Me.Controls.Add(departmentDropDown)
e.Layout.Bands(0).Columns("DepartmentName").ValueList = departmentDropDown
Me.categories = New CategoryList(String.Empty).Categories
Me.categoryDropDown = New UltraDropDown()
Me.categoryDropDown.DisplayLayout.Override.CellAppearance.BackColor = Color.LightSkyBlue
Me.categoryDropDown.SetDataBinding(categories, "")
Me.Controls.Add(categoryDropDown)
e.Layout.Bands(0).Columns("CategoryName").ValueList = categoryDropDown
End Sub
Okay, I think I see the problem. When you load the layout, the grid is going to try to hook up the DropDowns by name. But since you are creating them in code at run-time, they have no name. So you probably just need to set the Name property on each one to a unique name and that should fix it.