I saw this post (https://es.infragistics.com/community/forums/f/retired-products-and-controls/53503/enabling-individual-checkbox-cell-s-in-webgrid/276918#276918) about checkboxes, however, the example that is mentioned to be attached, does not appear to be attached any longer. Can we get another sample of this?
Also, is there a way that you can access any other cells other than the adjacent cell? We need to be able to disable/mark as readonly other cells in that row beyond the adjacent cell? We will not know where the other columns will be as the user can move things around, so we would need to find them via the column key and be able to edit that cell or make it readonly or enabled based on the current columns values.
We are using the WebDataGrid in 2011v1.2116.
I looked in the WebDataGrid1_RowUpdated and WebDataGrid1_InitializeRow events but the objects you could get did not seem to have a way to get to cell's enabled/disabled property.
I can see how that might work.
I am assuming that on RowUpdate of the Unit Price or Units on Order, you could then recalc the Total field. But if this value is to be stored, for whatever reason, in the DB, since it is not "bound", how would it get updated to reflect the changes in the dataset so that it can be saved back to the DB? Also can you enable/disable (allow edits/readonly) Unbound columns on RowUpdate? Will the changes to the Unbound columns show up at all when you call GetChanges() of the Grid Datasource?
So back to these questions:
Column X (Data column), Column Y (Templated Image Column) needs to be updatable due to change by Column A (both data and accessibility - readonly/editable). It was stated that Column X must then be an Unbound column in order to be updated like this. Does Y also have to be unbound or is a TemplateDataFiled ok? Once the data in Column A changes, how do we get the data in Column X to change not just in the visual, but also in the datasource such that it can be saved back to the DB and how do we get Column Y's image template to change on Update?
I was actually incorrect. My updates to the StatusId column seem to only be superficial as once I am done and click on my "Save" button and check Changes, the StatusId field values are actually the old values and not the new ones. So I am still missing something.
In RowUpdating this is what I am doing:
Dim poStatusId As GridRecordItem = poRow.Items.FindItemByKey("StatusId") Dim poStatus As GridRecordItem = poRow.Items.FindItemByKey("Status") Select Case poStatusId.Value Case 1 poStatus.Tooltip = "New" poStatus.Template = New CustomImageColumnHeader("images/Add.png", "New")
Case Else
...
End Select
The statusId is correct at this point, but setting the template of the row's item does not seem to update the Image.
I am not sure if this is how you are supposed to do it, but it appears to work. I had to set the value for the column (in this case StatusId) in three places on RowUpdating
e.UnboundValues.Item("StatusId") = statusId WebDataGrid1.Rows.FromIDPair(e.RowID).Items.FindItemByKey("StatusId").Value = statusId e.Values.Item("StatusId") = statusId
I had to do all three or it did not seem to update at all.
Now the remaining task is to figure out how to get the ItemTemplate that is an image that is tied to the StatusId field to update correctly. I thought setting the ItemTemplate to a new ItemTemplate with the new image tied to the new status Id, but the image does not change. Do I need to do something specific to the column to get it to redraw the correct image (the new status icon image)?
The initial value seems to be set - my guess is that this is because it is named the same as the ColumnName and is in the same position as what the columns were created as. Otherwise, I am not sure why this works.
Still need to figure out how to get the unbound cells updated. I had thought that using the UnboundValues Hashtable in the RowUpdating would work, but the changes seem to already be "fixed" at that point either that or I need to set something to "apply" changes that I am making in that event.