Dear All,
For now I have a datagrid with just one column of checkbox. I normally first called a function design grid and below is my code
gridAuthorization.AutoGenerateColumns = false;
gridAuthorization.Columns.Add("subMenu1ID","");
gridAuthorization.Columns[0].Visible = false;gridAuthorization.Columns.Add("subMenu1Name","Sub Menu Name");
gridAuthorization.Columns[1].ReadOnly = true;
gridAuthorization.Columns[1].Width = 200;
DataGridViewCheckBoxColumn cbSelect = new DataGridViewCheckBoxColumn();
{
cbSelect.HeaderText = "Select";
cbSelect.AutoSizeMode =
DataGridViewAutoSizeColumnMode.AllCells;
cbSelect.DisplayIndex = 8;
}
gridAuthorization.Columns.Add(cbSelect);
Then I call a function called as populateGrid and I run my select statements and accoridingly I will call the gridAuthorization.Rows.Add and accordingly add the rows.
The problem now I want another datagrid where the columns of checkbox should be dynamic like maybe first row only have 2 columns third row may have 4 columns etc.
For example my select column1,column2,column3,column4 from tblSubMenu. So I want to see if my column1 has a value then I want to put the checkbox and accordingly for other columns. Is this possible?
For now I have a datagrid with just one column of checkbox. I normally first called a function design grid and below is my code
gridAuthorization.AutoGenerateColumns = false;
gridAuthorization.Columns.Add("subMenu1ID","");
gridAuthorization.Columns[0].Visible = false;gridAuthorization.Columns.Add("subMenu1Name","Sub Menu Name");
gridAuthorization.Columns[1].ReadOnly = true;
gridAuthorization.Columns[1].Width = 200;
DataGridViewCheckBoxColumn cbSelect = new DataGridViewCheckBoxColumn();
{
cbSelect.HeaderText = "Select";
cbSelect.AutoSizeMode =
DataGridViewAutoSizeColumnMode.AllCells;
cbSelect.DisplayIndex = 8;
}
gridAuthorization.Columns.Add(cbSelect);
Then I call a function called as populateGrid and I run my select statements and accoridingly I will call the gridAuthorization.Rows.Add and accordingly add the rows.
The problem now I want another datagrid where the columns of checkbox should be dynamic like maybe first row only have 2 columns third row may have 4 columns etc.
For example my select column1,column2,column3,column4 from tblSubMenu. So I want to see if my column1 has a value then I want to put the checkbox and accordingly for other columns. Is this possible?