菜单之间无法关联的问题;

请教一下,我想实现菜单间的关联,选择第一列菜单,第二列只出现与之相关的内容,但实际运行起来,选择第一列菜单后,第二列的内容是空的,请问是什么原因呢,代码和截图如下,请专业人士帮我分析一下,谢谢;

img

   private void ComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            DataGridViewComboBoxEditingControl ComboBox = sender as DataGridViewComboBoxEditingControl;

            string selectedprocess;

            if (ComboBox.SelectedValue != null)
            {
                selectedprocess = ComboBox.SelectedValue.ToString(); // 选择对应的下拉值
                
            }

            int currentColumnIndex = dataGridView1.CurrentCell.ColumnIndex;

            int nextColumnIndex = currentColumnIndex + 1;     

            // 根据当前列的索引来判断下一列是否存在
            if (nextColumnIndex < dataGridView1.Columns.Count)
            {
                DataGridViewComboBoxColumn nextColumn = dataGridView1.Columns[nextColumnIndex] as DataGridViewComboBoxColumn;

                // 根据选中的产品,筛选出对应的规格信息
                List<string> filteredprocessList = GetFilteredprocessList(selectedProcess);

                nextColumn.DataSource = filteredprocessList;
            }

        }

        private List<string> GetFilteredprocessList(string product)
        {
            // 根据选中的产品,返回对应的规格列表
            // 这里假设你有一个方法可以根据产品获取对应的规格信息
            List<string> process = new List<string>();

            switch (product)
            {
                case "制粒":
                    process = new List<string> { "心可舒" };
                    break;

                case "提取":
                    process = new List<string> { "脑血舒" };
                    break;

            }

            return process;

        }

调试下,第一,在选择前面的下拉后,ComboBox_SelectedIndexChanged这个方法执行了没有
第二 nextColumn 有没有值
第三,加上一个
nextColumn.Bind() 或者 DataBind() 之类的(记不得了),刷新下绑定
还不会,可以远程帮你看看