Click here to Skip to main content
15,896,486 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have one gridview. in that gridview i want to give color to caption.

Gridview as follows

Student details(Gridview Caption)
studid studname course
1 Raj MFA
2 Ramesh EFA
3 Vignesh SSO
4 Ram RSSO
5 Sudha ERS

I want to give color Gridview caption(Student details).

for that how can i do.

Regards,
Narasiman P.
Posted

The great thing about developing with Microsoft products is using Intellisense. This should be the kind of thing that you can find pretty easily by poking around.

You can get to the Grid's header row by using the grid.HeaderRow property.https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.headerrow(v=vs.110).aspx[^]

Set the row's ForeColor property. https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridviewrow(v=vs.110).aspx[^]
 
Share this answer
 
v2
This might help you :
Gridview with Fixed Header[^]
 
Share this answer
 
v2
It's a two step process :
1. First use ColumnHeadersDefaultCellStyle.BackColor property for datagridview to set header backcolor.
<grid>.ColumnHeadersDefaultCellStyle.BackColor = Color.<any color="">;
2. Then need to set EnableHeadersVisualStyles property to false.
<grid>.EnableHeadersVisualStyles = false;

Hope it helped.
 
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