Hi,
I''m having a problem resetting GridStyleInfos on a grid. I need to turn Readonly on a combobox cell on or off dynamically, and I have tried all kinds of stuff, but the cells that were put into read-only stay in readonly, even if I overwrite them with another GridStyleInfo. I also tried a clear on the grid first, but it hasn''t affected the problem at all.
Here''s my code, which gets called when I change a combo on the form:
///
/// Initiates datasources for controls & accessibility in grid.
///
private void initGrids()
{
this.grdParams.BeginUpdate();
this.grdParams.Clear(true);
this.grdParams.Clear(false);
//Headernamen:
this.grdParams[0,1].Text = "TableName";
this.grdParams[0,2].Text = "ColumnName";
this.grdParams[0,3].Text = "Modifier";
this.grdParams[0,4].Text = "Param1";
this.grdParams[0,5].Text = "Param2";
this.grdParams[0,6].Text = "Connector";
//Data in grid plaatsen:
SetDataForGrid();
this.grdParams.Refresh();
//Instellen combo connector (AND/OR) in grid
System.Collections.Specialized.StringCollection connectors = new System.Collections.Specialized.StringCollection();
connectors.Add("AND");
connectors.Add("OR");
GridStyleInfo ConStyle = new GridStyleInfo();
ConStyle.CellType = "ComboBox";
ConStyle.ChoiceList = connectors;
ConStyle.ExclusiveChoiceList = true;
ConStyle.ReadOnly = false;
ConStyle.BackColor = Color.White;
for(int bar = 1; bar<=grdParams.RowCount;bar++)
{
this.grdParams.ChangeCells(GridRangeInfo.Cell(bar,6),ConStyle);
}
this.grdParams.ChangeCells(GridRangeInfo.Col(6),ConStyle);
//instellen combo Modifier als er rijen zijn:
if(grdParams.RowCount != 0)
{
GridStyleInfo Modifstyle = new GridStyleInfo();
Modifstyle.CellType = "ComboBox";
Modifstyle.DataSource = m_Controller.FullDS.FilterTypes;
Modifstyle.DisplayMember = "FilterType";
Modifstyle.ValueMember = "operand";
Modifstyle.ExclusiveChoiceList = true;
this.grdParams.ChangeCells(GridRangeInfo.Cells(1,3,grdParams.RowCount,3),Modifstyle);
}
//Ophalen rijnummers voor AND/OR
this.m_SwitchRows = this.m_Controller.CurrentReport.GetRelationRowNumbers();
//Readonly zetten van de juiste cellen in connector-kolom:
GridStyleInfo ReadonlyStyle = new GridStyleInfo();
ReadonlyStyle.Clickable = false;
ReadonlyStyle.ReadOnly = true;
ReadonlyStyle.BackColor = Color.LightGray;
ReadonlyStyle.ExclusiveChoiceList = false;
for(int foo = 0;foo
AD
Administrator
Syncfusion Team
January 18, 2006 12:39 PM UTC
Hi,
If you later want to make a change to a readonly column, please set grid.IgnoreReadOnly = true, then make the change, and then set grid.ReadOnly back to false. This is by design.
this.grdParams.IgnoreReadOnly = true;
for(int foo = 1;foo < 10; foo = foo + 2)
{
this.grdParams.ChangeCells(GridRangeInfo.Cell(foo,6),ReadonlyStyle);
}
this.grdParams.IgnoreReadOnly = false;
Let me know if you need futher assistance,
Regards,
Madhan.