I have a C# Win ultraGrid with several groups and several users under each group.
I have a name (hidden) an alias. I made it so when you right click it, there's an option to reset the alias to the name by:
this.ultraGridUsers.Selected.Rows[0].Cells["Alias"].Value
= this.ultraGridUsers.Selected.Rows[0].Cells["UnitID"].Text
Is there a way to reset the whole grid? I tried:
this.ultraGridUsers.Rows[0].Cells["Alias"].Value = this.ultraGridUsers.Rows[0].Cells["UnitID"].Text;
but it's giving me a 'key' error.
Pardon me, but I still have difficulties here. If this is working:
then what isn't working?
All the users are in the second band, yes-- band[1]. The group is band[0].
I'm using the .value & .text to set the value of the "Alias" value (value) to take in whatever is in the "UnitID" field (text), it seems to work.
The true identity of each cell is the "UnitID." You can give it an alias, "Alias." I made an event listener when you click something, it will erase the "Alias" and default to the "UnitID" (unchangeable).
That's what the above code does. Let's say if I have several that are aliased and want to reset the whole list. is there a way to do that?
UnitID: p111 Alias: BobUnitID: p1121 Alias: RobUnitID: p1234 Alias: Job
When I right-click "bob" and click "reset alias" it will rename the Alias to the UnitID: P111
I was wondering if there was a way to do it for all in one click.
Are your users in the second band? grid.Rows are only the first band rows.
Why do you use Value and then Text?
What do you mean by "reset the whole grid"?
BTW, you can avoid all those "Cells[]" statements (that affect performance), and use the data object itself. Any row has a ListObject property that you can cast and change anything you want in it, like:
var dataObject = row.ListObject as MyDataObject;
dataObject.Alias = dataObject.UnitID;
However, if you still want to play with Cells[], you can use the row.GetCellValue(columnKey) when you want to get the value, which skips creating the cell object.