I have grid where each cell represents some quantity of different widgets. I would like the user to be able to press on button and switch from the quantity of the widget to its value. So, for example, widget1 is worth $5 a piece and widget2 is $6 a piece
Qty based display
widget1 1 2 3
widget2 5 10 15
Corresponding $ based display
widget1 $5 $10 $15
widget2 $30 $60 $90
This $-based grid is not editable since it is derived from the qty based information. But the qty-based grid is editable and how the information would be held in the datatable.
Since this $-based information is not editable, I am hoping I do not have to generate another datatable to hold these derived numbers. What are my options?
Thanks!
I would just change the value of the cell (onclick) to the new x*y value and slam a $ in front of it (and reverse the process to switch it back), but I am pretty lazy :)
The qty values are very important to maintain because a number of other calculations are tied to the qty values. If I were to do the x*y, the underlying table column value would also change (since the grid is bound to a table). Do so would ruin some of calculation which rely on that table holding qtys and not $ amounts.
I am hoping to get away with some "for the eyes only" kind of solution which would not mess with my underlying table field values. Thanks anyway!
So I am still awaiting for any suggestions?
Yeah I figured that, Don't change your value change your text with the updated cacluation I do it all the time... For that matter I do it on the webgrid to look at the demo challenge we are doing right now http://outlook.visualstudiotutorials.com and you will notice that the images like read, attachment etc. that is just the display text the "value" is 0, 1 on those cells. you can do the same thing in the wingrid
I found that in UltraWinGrid, a cell's text property is read-only.
Try this and it won't compile -> ultraGrid1.DisplayLayout.Rows[0].Cells[0].Text = "hello"
Did you mean some other property?
So I am still looking for suggestions.
Chris Bishop said:you thought about adding unbound columns? and then just looping through to do your cacluations?
Yes, I have been thinking of a similar idea. I was thinking I would create another table to hold these value and writing event handler to keep them in synch. As you suggest I can instead create a new column for every qty data column. The dollar data column can been tied to qty data column using CalcManager formulas . The disadvantage is both options would double the amount of memory. Your text attribute idea was very promising and would have been an "eyes only" kind of solution I was looking for if had worked. Thanks again for trying hard for the solution.
I will see if Mike Saltzman has some suggestions on Monday.
weird every once in awhile it tells me i cannot post without approval hmmmm....Well incase you don't get my last message i will try it again... I don't think you are going to be able to do the "text vs value" thing (sorry haven't been in win controls in awhile so gave you the wrong adivse there)...
Knowing that you do not want to modify your dataset have you tried adding unbound colums?Something like:
using Infragistics.Win.UltraWinGrid;
public class Form1 { private void Form1_Load(object sender, System.EventArgs e) { this.UltraGrid1.DisplayLayout.Bands(0).Columns.Add("widgetAcol", "WidgetA Text"); UltraGridRow x; foreach ( x in UltraGrid1.Rows) { if (x.Cells(0).Value == 1) { x.Cells(4).Value = "I am widget a text value"; } } } }
just noticed that myself (haven't been in the win controls in awhile) I am not sure you are going to be able to do the "text vs value" thing however knowing that you don't want to mess with your dataset have you thought about adding unbound columns? and then just looping through to do your cacluations?
something like: