.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ADO.Net >> Post New QuestionBookmark and Share Subscribe to Forum

change background color of cell in Gridview programatically

Posted By: priya     Posted Date: March 08, 2009    Points:2   Category :ADO.Net
Hello Friends,
How to change the background color of a cell for a particular row inside gridview programatically using C# in Asp.net.

Please help me

Regards
priya

Responses
Author: Rahul             
Posted Date: March 11, 2009     Points: 5   

Hi,
you can use "RowDataBound" event of gridview and use Cells[index].BackColor properties for eg.


protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{

e.Row.Cells[2].BackColor = System.Drawing.Color.Red;
}
}


Author: Athira Sreejith             
Posted Date: March 11, 2009     Points: 5   

Hi.,.
Try like this..


protected void gvLeaveApproval_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.BackColor = System.Drawing.Color.Pink;
}
}

Author: Athira Sreejith             
Posted Date: March 11, 2009     Points: 5   

Hi.,.
Try like this..


protected void gvLeaveApproval_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.BackColor = System.Drawing.Color.Pink;
}
}

Author: subhash             
Posted Date: September 26, 2009     Points: 5   

he see it is very simple

Author: subhash             
Posted Date: September 26, 2009     Points: 5   

this is new



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend