HI-LIGHTING GRIDVIEW ROWS

Please find the attached Mark UP code containing two Gridviews 1 and 2.  Both contain a OnRowDataBound event to fire highlighting of rows based on a condition.   I have the columns correct; however, they are not firing.  Any assistance would be appreciated.  The correct columns are identified.
 <td valign="top" width="375" style="font-size: small">
                    <asp:GridView ID="GridView1" onrowdatabound="GridView1_RowDataBound" runat="server" AllowSorting="True" 
                        AutoGenerateColumns="False" CellPadding="4" DataKeyNames="ID" 
                        DataSourceID="SqlDataSource1" EnableModelValidation="True" ForeColor="#333333" 
                        GridLines="None" Width="375px">

Open in new window



<asp:GridView ID="GridView2" onrowdatabound="GridView2_RowDataBound" runat="server" AllowSorting="True" 
                        AutoGenerateColumns="False" CellPadding="4" DataKeyNames="ID" 
                        DataSourceID="SqlDataSource2" EnableModelValidation="True" ForeColor="#333333" 
                        GridLines="None" Width="925px" style="font-size: small">
                        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />

Open in new window

Code Behind:*********************************************************

using System;
using System.IO;
using System.Text;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;
using System.Data.SqlClient;
using System.Data.Sql;

public partial class BigBoardDisp : System.Web.UI.Page
{
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
            if (e.Row.Cells[5].Text == "BOB" || e.Row.Cells[5].Equals(DBNull.Value))
            {
                e.Row.BackColor = System.Drawing.Color.Green;
            }

    }


    protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
    {

        if (e.Row.RowType == DataControlRowType.DataRow)
            if (e.Row.Cells[3].Text == "BOB" || e.Row.Cells[3].Equals(DBNull.Value))
            {
                e.Row.BackColor = System.Drawing.Color.Green;
            }

    }

Open in new window

BOEING39Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Srihari03Commented:
When you set autogenerateColumns to false you have to define your row templates. You have to set autogenerate columns to true. Then only the event will fire. Thats why the row didn't render and hence your event didn't fire.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BOEING39Author Commented:
Thx
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.