private void gvFiles_RowFormatting(Object sender, RowFormattingEventArgs e)
{
if (e.RowElement.RowInfo is GridViewDataRowInfo)
{
//mandatory conditions
if ((string)e.RowElement.RowInfo.Cells["OrderPay"].Value == "1" && e.RowElement.RowInfo.Cells["FID"].Value == DBNull.Value)
{
//if the "Extended" nothing is written
if (e.RowElement.RowInfo.Cells["Extended"].Value.Equals(DBNull.Value))
{
//then to the current date add 14 days and to compare the date in "DateEnd".
if (DateTime.Now.AddDays(Properties.Settings.Default.WarningDays) >= Convert.ToDateTime(e.RowElement.RowInfo.Cells["DateEnd"].Value))
//if it is greater than or equal, display a red line.
e.RowElement.ForeColor = Color.Red;
} //otherwise, if the "Extended" is not equal to zero
else if (!e.RowElement.RowInfo.Cells["Extended"].Value.Equals(DBNull.Value))
{
//then compare with segdonyashney date have "Extended" and "DateEnd".
if (DateTime.Now.AddDays(Properties.Settings.Default.WarningDays) >= Convert.ToDateTime(e.RowElement.RowInfo.Cells["DateEnd"].Value) &&
DateTime.Now.AddDays(Properties.Settings.Default.WarningDays) >= Convert.ToDateTime(e.RowElement.RowInfo.Cells["Extended"].Value))
e.RowElement.ForeColor = Color.Red;
}
else
e.RowElement.ResetValue(LightVisualElement.ForeColorProperty, ValueResetFlags.Local);
}
else
e.RowElement.ResetValue(LightVisualElement.ForeColorProperty, ValueResetFlags.Local);
}
}
It works.
But when you press the grouping and gruppiruesh on a particular column, it starts to produce the correct lines in red and those that it should be allocated.
Moreover, hide and reveal to the grouping and each time he paints in red color different rows.
And more.
In the GridView I have built a hierarchy. After grouping near the rows, press the + to see the subitems, instead udlenit write down, it hides all the items below. Shown.
1 - Normal GridView
2 - After grouping the first element is painted red, although it should not be released under the terms of
3 - If during the press groups see subitems, then the rows disappear from the bottom somewhere O_O
{
if (e.RowElement.RowInfo is GridViewDataRowInfo)
{
//mandatory conditions
if ((string)e.RowElement.RowInfo.Cells["OrderPay"].Value == "1" && e.RowElement.RowInfo.Cells["FID"].Value == DBNull.Value)
{
//if the "Extended" nothing is written
if (e.RowElement.RowInfo.Cells["Extended"].Value.Equals(DBNull.Value))
{
//then to the current date add 14 days and to compare the date in "DateEnd".
if (DateTime.Now.AddDays(Properties.Settings.Default.WarningDays) >= Convert.ToDateTime(e.RowElement.RowInfo.Cells["DateEnd"].Value))
//if it is greater than or equal, display a red line.
e.RowElement.ForeColor = Color.Red;
} //otherwise, if the "Extended" is not equal to zero
else if (!e.RowElement.RowInfo.Cells["Extended"].Value.Equals(DBNull.Value))
{
//then compare with segdonyashney date have "Extended" and "DateEnd".
if (DateTime.Now.AddDays(Properties.Settings.Default.WarningDays) >= Convert.ToDateTime(e.RowElement.RowInfo.Cells["DateEnd"].Value) &&
DateTime.Now.AddDays(Properties.Settings.Default.WarningDays) >= Convert.ToDateTime(e.RowElement.RowInfo.Cells["Extended"].Value))
e.RowElement.ForeColor = Color.Red;
}
else
e.RowElement.ResetValue(LightVisualElement.ForeColorProperty, ValueResetFlags.Local);
}
else
e.RowElement.ResetValue(LightVisualElement.ForeColorProperty, ValueResetFlags.Local);
}
}
It works.
But when you press the grouping and gruppiruesh on a particular column, it starts to produce the correct lines in red and those that it should be allocated.
Moreover, hide and reveal to the grouping and each time he paints in red color different rows.
And more.
In the GridView I have built a hierarchy. After grouping near the rows, press the + to see the subitems, instead udlenit write down, it hides all the items below. Shown.
1 - Normal GridView
2 - After grouping the first element is painted red, although it should not be released under the terms of
3 - If during the press groups see subitems, then the rows disappear from the bottom somewhere O_O