Hello!
I have a grid that is filled with different types of products. One column in this grid is a cost price column.
I have added summaries to the grid and my idea was to get the total price of the products through the summary value that is based on the cost price column.
Another option could be to calculate the total price based on the datasource that populates the grid, but since I have enabled editing of the grid, it feels a bit wrong.
At the moment, I am setting the cost price in the summaryvaluechanged event, which then calculates the sales price. So we have:
summaryvaluechanged->costprice->salesprice.
The summaryValueChanged event fires many times, since I have groupbyrows. However, it works even if it is fired many times.
So far so good...
It is quite common that the users wants to override the sales price and create some sort of rounded value that is presented to the customer.
The problem that I get is when I export the data from the grid to excel. The grid seems to be re-generated when it is exported, so the summaryvaluechanged event fires a new round. This means that the cost price is calculated again, and so is the sales price. It gets overwritten which is not good. I ahve tried to lock down the event before i export the grid and to open it up again after it is exported. However, since the grid works async, I turn on the event before the summaryvaluechanged event has finished firing. So the value is overwritten...
I hope that someone can understand what I am trying to explain. I am not sure if I understand it myself ;-)
Any ideas?
/Henrik
thanks, that could be really useful. by the way, is there some sort of way finding out when the top level summary value changed event is fired? that could be useful as well. then i can handle that one only...
Hello Henrik,Thank you for posting in our forum.Without providing me a sample solution I cannot be quite sure what exactly you are trying to achieve. However from your post I understand that you have an issue while exporting the grid to Excel. Please note that when the export starts the exporter creates a copy of the Layout. So one possible solution to your issue could be if you check in SuumaryValueChanged event handler if the event was fired by the exported layout. You can use code like this:private void ultraGrid1_SummaryValueChanged(object sender, SummaryValueChangedEventArgs e){ if (e.SummaryValue.ParentRows.Band.Layout.IsExportLayout) { return; }}Please let me know if this solves your issue. If note please try to isolate this behavior in small sample solution and send it to me in order to be able to research a possible solution for you. Looking forward to your reply.