Click here to Skip to main content
15,884,834 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Output as follows;


Date Session RK Mk CK Gk VK CMK CNN UNNi VB GS CM JN CA

1/7/12 1 REO Tasco AFF
1/7/12 2 REO Tasco AFF
1/7/12 3 REO Tasco AFF
1/7/12 4 REO Tasco AFF

1/8/12 1 REO Tasco AFF
1/8/12 2 REO Tasco AFF
1/8/12 3 REO Tasco AFF
1/8/12 4 REO Tasco AFF

from the output

fore color has light blue and back ground color as Sky Blue in 1/7/12 date
fore color has light brownand back ground color as purple in 1/8/12 date


for 1/7/12 1to 4 session give fore color and background color different.
for 1/8/12 1to 4 session give fore color and background color different.
Posted
Comments
Wendelius 12-Jan-13 6:00am    
Where do show the rows? in grid, combobox etc. Also what technology you use ASP.NET, WPF, Forms...
Richard MacCutchan 12-Jan-13 9:49am    
I have deleted the other two copies of this question as they do not add any useful detail. Please edit your question and explain exactly what you are trying to do, including what class you are using that contains these rows.

1 solution

If you are using winforms this would be how you achieve what you are looking for.

Im not entirely sure what the last part means as i dont know what 1 to 4 session means.

"for 1/7/12 1to 4 session give fore color and background color different.
for 1/8/12 1to 4 session give fore color and background color different."

C#
private void gridview_RowStyle(object sender, RowStyleEventArgs e)
{
    GridView View = sender as GridView;
    if (e.RowHandle >= 0)
    {
        string searchOne  = View.GetRowCellDisplayText(e.RowHandle, View.Columns["1/7/12"]);
        string searchTwo  = View.GetRowCellDisplayText(e.RowHandle, View.Columns["1/8/12"]);

        if (searchOne == "1/7/12")
        {
            e.Appearance.BackColor = Color.SkyBlue;
            e.Appearance.ForeColor = Color.LightBlue;
        }

        if (searchOne == "1/8/12")
        {
            e.Appearance.ForeColor = Color.Brown;
            e.Appearance.BackColor = Color.Purple;
        }
    }
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900