change row color of empty row

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm adding a empty row for every so many rows in my GridView. I want to
change the color of the empty row so the grid is "broken up" per say. I tried
this:

grid_RowDataBound()
{
if(e.Row.Cell[0].text.Equals(" ")
{
e.Row.BackColor = Color.Orange;
}

}
and it doesn't work
I also set the EmptyDataRowStyle = orange and still nothing. so how can i
get my empty row to be orange?
 
Hi,

e.Row.BackColor should work, for example:

protected void GridView1_RowDataBound(object sender,
GridViewRowEventArgs e)
{
if (e.Row.RowIndex % 2 == 0)
{
e.Row.BackColor = Color.Orange;
}
}

This will change every even row's back color to orange color.

How did you add those empty rows?

Sincerely,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
yeah, i've tried this and still nothing. Its like the RowDataBound isn't
being called at all when the grid renders. I put other code in there as well
and thats not even being called.
So, for now Im going to leave it as is. I'll look at it later down the road
 
Hi,

That's strange for a data-bounding GridView not firing the event
RowDataBound. Would you please post some code? Thanks.

Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top