I have following requirements to get done.
Add unbound column for "Edit" button in each row, preferly at the last column.
Once user clicks "Edit" that row is now editable, but only few columns are allowed to be edited. Also the "edit" button now becomes "Cancel" so that user may cancel that particular row out of edit mode, restoring the original value.
User may choose to edit one or more rows so it keeps multiple rows in edit mode.
Button outside of the grid will trigger the rows in edit mode to be updated.
I look everywhere for training video but couldn't find any that will do "edit" row. Also I'm clueless of what edit template is. If you know of any helpful video link, let me know.
TIA.
Fyi, the grid is bound at runtime. The UltraGrid version is 7.1 and we do have the latest version with license. We would like to keep the 7.1 in place if possible.
Hi,
There's a lot of stuff here. Which part of this is giving you trouble?
To add a button column to the grid, you would use the InitializeLayout event. You can add an unbound column to the root band and set it's Style to Button. You would use the InitializeRow event to populate the value of the cells in this column with whatever text you want to be on the button. So you would probably have to examine the row to see if the cells are editable and base the text on that.You use the ClickCellButton event of the grid to handle clicks on this button.
To enable certain cells, you would use the Activation property on the cell. You will probably also want to use CellActivation on the column to permanently disable certain fields.
Here's a KB article the describes all the ways you can disable things in the grid.
HOWTO:How can I make a grid or a column, row, or cell in the UltraWinGrid disabled or read-only?
A RowEditTemplate is like a form that displays and edits values from a single row in the grid.
Thank you for replying.
I made some progress within last few days and I believe you indicated what I have done so far. First using InitializeLayout, I added unbound column. On MouseUp event, I check for Column.Key to see if it is the unbound column. If so, I alternate the cell value from "Edit" to "Cancel". At the same time, I also set desire columns to be CellClickAction.Edit or RowSelect. So far so good. Now I'm stuck in where I need to put databound dropdownlist in the cell while in Edit mode. I also need to display Calendar control in one of the column to be used as datatime value. Can you help?
Thanks.
I used ValueListResolved and that seems to get the correct dropdownlist.
The InitializeRow event didn't work out. This was mainly to change cosmetics of cells. I tried getting ValueList and tie to dropdownlist so that I can bound to it. But ValueList always return nothing even though I assigned to the column in InitializeLayout. I would need further help, pls. Thanks.
The grid cell example for putting dropdownlist is only good for InitializeLayout where the dropdownlist is somewhat global and the dataset is used on all rows. The dropdownlist I need to populate is databound to certain columns within the row so the list will be different each rows. Perhaps I can do exactly samething in InitializeRow instead. I'm giving it a try for now. Let me know if you have any better ideas. Thanks.
HSNetDev said:On MouseUp event, I check for Column.Key to see if it is the unbound column. If so, I alternate the cell value from "Edit" to "Cancel".
If the column style is set to Button, you could do this in the ClickCellButton event.
HSNetDev said:Now I'm stuck in where I need to put databound dropdownlist in the cell while in Edit mode.
HOWTO:What is the best way to place a DropDown list in a grid cell?
HSNetDev said:I also need to display Calendar control in one of the column to be used as datatime value.
If the DataType of the column is DateTime, then the grid will automatically default to showing a date dropdown in the cell. You do not have to do anything.