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
740
Setting Appearance for Bands taking time
posted

Hi,

 I need to set fore color RED for minus values in particular columns in the gird. The grid has 3 bands. I have set the vlaues in InitializeRow event in the following way and I have set up the grid's DataSource when loading the form.

private void grid1_InitializeRow(object sender, InitializeRowEventArgs e)

{

if (e.Row != null)

{

if (e.Row.Band.Index == 0)

{

if (Convert.ToDecimal(e.Row.Cells["col1"].Value) < 0)

e.Row.Cells["col1"].Appearance.ForeColor = Color.Red;

if (Convert.ToDecimal(e.Row.Cells["col2"].Value) < 0)

e.Row.Cells["col2"].Appearance.ForeColor = Color.Red;

}if (e.Row.Band.Index == 1)

{

if (Convert.ToDecimal(e.Row.Cells["col1"].Value) < 0)

e.Row.Cells["col1"].Appearance.ForeColor = Color.Red;

if (Convert.ToDecimal(e.Row.Cells["col2"].Value) < 0)

e.Row.Cells["col2"].Appearance.ForeColor = Color.Red;

if (Convert.ToDecimal(e.Row.Cells["col3"].Value) < 0)

e.Row.Cells["col3"].Appearance.ForeColor = Color.Red;

}

if (e.Row.Band.Index == 2)

{

if (Convert.ToDecimal(e.Row.Cells["col1"].Value) < 0)e.Row.Cells["col1"].Appearance.ForeColor = Color.Red;

}

}

}

This method is taking a long time load the values for the grid. Can anyone let me know is there a better way to do this same functionality?

Thanks in Advance!

nw

 

Parents Reply Children
No Data