Click here to Skip to main content
15,908,675 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hi this is part of my code
C#
if (e.Row.RowType == DataControlRowType.DataRow)
           {
               HiddenField rowType = (HiddenField)e.Row.FindControl("RowType");
               if (rowType != null)
               {
                   switch (rowType.Value)
                   {
                       case "2":
                           ((HyperLink)(e.Row.FindControl("FactorName"))).NavigateUrl = "http://www.google.com";
                           ((HyperLink)(e.Row.FindControl("FactorName"))).Font.Bold = true;
                           break;
                       case "3":
                           ignoreRow = true;
                           try
                           {
                               ((Label)(e.Row.FindControl("VAL1"))).Text = "";
                           }
                           catch { }
                           break;
                       case "4":
                   grdSAS.Rows[e.Row.RowIndex - 1].Attributes.Add("style", "Background-color:#ccc");


                   //do summerize;
                   break;
                   }

               }
           }
       }


in part
grdSAS.Rows[e.Row.RowIndex - 1].Attributes.Add("style", "Background-color:#ccc"); i need to add css
i add
.Attributes.Add("style", "Background-color:#ccc");
but have error
pleas help me to solve this problem
Posted
Comments
ZurdoDev 23-May-15 23:00pm    
What's the error?
Member 11686005 24-May-15 1:13am    
i cant underestand please help me

Try like below. Also debug your code and see what is happening.
C#
grdSAS.Rows[e.Row.RowIndex - 1].Attributes["style"] = "background-color: #ccc";
 
Share this answer
 
Comments
Member 11686005 24-May-15 3:13am    
thanks about good solution
Please accept the solution. :)
Try this solution.
row.Attributes.Add("style", "background-color: #ccc";);
 
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