Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
330
Reset all values
posted

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.

Parents
  • 17259
    Offline posted

    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.

Reply Children