I'm working on a Customer Form for my application. We need to track a 1:many relationship between the customer and internal Orgaqnizations for the firm. There are currently three which is unlikely to ever change (perhaps there would be a few more over time).
I'd like to represent this by showing a grid of all Three organizations for the firm with a checkbox indicating whether the current customer is assigned to that organization. I bound the Grid to the global Organization List - ID (Hidden), Name, and Description - each set to ReadOnly (CellActivition: NoEdit)
At design time I added an Unbound Column Named "Selected" with type of "Boolean" and Style "Checkbox"
In the Initialize Row Event, I check the Customer's List of Organizations, if the ID is present I set the checkbox value to True.
In the "Save Button Click" Event - I iterate through the grid rows to check the state of the checkbox - if it will get added to the customer's list (assuming it hasn't already) and if clear - Remove it from the list if it exists.
Here's my problem:
Setting the checkboxes work fine - by clearing them doesn't. The value still shows as True. Also If I click on another checkbox after clearing one, it reverts the first box back to checked.
How can I get the grid to behave the way I desire?
Thanks!
Dan
It is difficult to speculate about the problem without a sample project or code. If possible provide a sample project that demonstrates the problem, or if that is not possible, a code sample, and we will try to help.
This morning I reviewed the problem with a co-worker who has a lot more experience with the Infragistic controls... Much of my experience is using ASP.NET Gridview - which has an "On Row Databound" Event which I assumed the Initialize Row event was the correlary to.
My coworker was aware that the RowInitialize event fires very often (I haven't quite figured out when - it seems like it fires when the row loses focus?) and that is where my code is populating the value of the unbound field - so it was resetting the value to the state of the business object when the form was loaded.
I was able to solve my problem by putting the following code in the event: - since it will ignore calls to the event other than the first initialization (desired behavior)
if
(e.ReInitialize)
return;