Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
314
Format cell text using value from other column/cell
posted

Hi!

If I have an UltraGrid that is bound to a class with Properties A and B and thus have the grid columns A and B; how can I use the cell values from column A in the formatting of the cell values of column B (or an unbound column C)?

From this data:

Col A | Col B

=============

ValA1  | ValB1

ValA2  | ValB2

I want to be able produce this display output:

Col A | Col B

=============

ValA1  | "ValA1 ValB1"

ValA2  | "ValA2 ValB2"

Parents
  • 71886
    Verified Answer
    Offline posted

    Hi Ulf!

    I am a little bit confused by your requirements. As I understand them - you want the second column's values, to be formed, as follows: Value of col1 + space character +  current value of col2. If that is really the case, then you could try using the following code sample, in order to achieve that:

            private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)

            {

                e.Row.Cells["Col B"].Value = e.Row.Cells["Col A"].Value.ToString() + " " + e.Row.Cells["Col B"].Value.ToString();

            }

    Please feel free to let me know if I misunderstood you or if you have any other questions.

Reply Children