Hi Sir,
I need your help regarding gridview(Infragistics.Win.UltraWinGrid). Here I have two columns one is textField and another one is Checkbox.
So, here I want to convert Checkbox into Toggle Button (OnOffSwitch Button). So, can You Please let me know regarding this Issue.
I will be very thankful for you.
Regards,
Kunal
jammerms said:Regarding disabling cells, setting CellActivation to Disabled greys out the columns. I don't want them greyed out, just not editable. So I set CellClickAction to RowSelect, and that seems to work.
You could also use a setting of NoEdit or ActivateOnly, which would prevent editing and not change the cell color. Or, you could use Disabled and set the DisabledForeColor on the cell's appearance.
Mike,
Thanks again for your help. I have been working support issues, and am only now able to try this.
I've had the column from the datasource set AllowDBNull = false the whole time. When I took out the line set the ultragrid's column Nullable to Disallow, I get no validation from the datasource as the value of the empty cell is the empty string, not null or dbnull.
So I'm not able to skirt the issue that way. Looks like I'll have to manually validate the cell's value. Let me know if there's an easier way to do this.
Regarding disabling cells, setting CellActivation to Disabled greys out the columns. I don't want them greyed out, just not editable. So I set CellClickAction to RowSelect, and that seems to work.
Thanks again,
J
Okay, I was able to reproduce the issue.
At a glance, it looks to me like the issue here is the Nullable property on the column. Since you are using the grid's column's Nullable property, the grid tries to validate the cell immediately when you try to leave it. The UpdateMode doesn't enter into it at all, because the grid is not committing the changes to the underlying data source at this point, it's just doing it's own built-in validation.
If, instead of using Nullable, your data source itself were set up to not allow nulls, then this validation would not occurr until you tried to update the row. So you might be able to work around this issue that way.
Oh... regarding disabling cells, there is an easier way. This KB article should help:
HOWTO:How can I make a grid or a column, row, or cell in the UltraWinGrid disabled or read-only?
The Name column does not allow nulls (in ugClinicalGroups_InitializeLayout: col.Nullable = Infragistics.Win.UltraWinGrid.Nullable.Disallow;), and the Delete column is the one with the button.
Here is some code:
In Initialize (_dtClinicalGroups is a DataTable)...
_dtClinicalGroups = _daoClinicalGroups.GetAllClinicalGroups(); ugClinicalGroups.DataSource = _dtClinicalGroups;ugClinicalGroups.UpdateMode = UpdateMode.OnUpdate;ugClinicalGroups.ActiveRow = null;ugClinicalGroups.Selected.Rows.Clear();
ColumnsCollection cols = e.Layout.Bands[0].Columns;
cols.Insert(cols.Count, "ASSIGN_USERS");
{
col.Header.Caption = "Delete";
col.Width = 50;
break;
Also, I subscribe to BeforeCellActivate to make sure only certain cells are editable (I set e.Cancel = true if it's a non-editable cell). Is this the best way to insure that only certain cells are editable?
Let me know if I can provide any additional information.
Thanks,