Click here to Skip to main content
Sign Up to vote bad
good
See more: Gridview
Hi there!
 
My GridView is into Repeater.
 
So after its binding I'm trying to change font color of the 2nd column.
 
       protected void Page_Load(object sender, EventArgs e)
        {
            GridView gv = (GridView)Page.FindControl("GridView1");
            gv.Columns[1].ControlStyle.ForeColor = System.Drawing.Color.Red;
        }
But got an error.
 
What event should I use?
 

Thank you!
Posted 3 Feb '13 - 10:53

Comments
Irbaz Haider Hashmi - 3 Feb '13 - 17:04
Try it changing the color after binding the grid.
Member 1474407 - 3 Feb '13 - 17:32
Thanks! The proper event is GridView1_RowDataBound.
Irbaz Haider Hashmi - 3 Feb '13 - 17:36
Thats what i want you to search out. :) RowDataBound is binding the grid with data.

1 solution

Solved!
 
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
       {
           e.Row.Cells[1].ForeColor = System.Drawing.Color.Red;
       }
  Permalink  

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 OriginalGriff 218
1 Ron Beyer 215
2 Aarti Meswania 190
3 Rohan Leuva 178
4 Mahesh Bailwal 160
0 Sergey Alexandrovich Kryukov 8,553
1 OriginalGriff 6,899
2 CPallini 3,648
3 Rohan Leuva 2,963
4 Maciej Los 2,308


Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 3 Feb 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid