Click here to Skip to main content
15,893,266 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
i am using active and dactive status in gridview i want when user select active status that rows colour became red and when user select deavtice status that row&s colour becam
red how we can do in asp.net c#
Posted
Comments
Karthik_Mahalingam 30-Jan-14 1:49am    
post code.

C#
protected void gridMembersList_RowCommand(object sender, GridViewCommandEventArgs e)
   {
        if (e.CommandName == "Active")
        {
            e.Row.BackColor = System.Drawing.Color.FromName("#cdd5ff");
        }
else if(e.CommandName == "Deactive")
{
 e.Row.BackColor = System.Drawing.Color.FromName("#cdd5ff");
}
    }


change the colors
 
Share this answer
 
try this:-

C#
protected void Gridview1_RowCommand(object sender, GridViewCommandEventArgs e)
   {
       if (e.Row.Cells[4].Text == "Active") //change your link button column index
        {
           e.Row.BackColor = ColorTranslator.FromHtml("#C2DAEC");
        }
      else
        {
              e.Row.BackColor = ColorTranslator.FromHtml("#ECE0C2");
        }
    }
 
Share this answer
 
Comments
Member 10426233 1-Feb-14 0:03am    
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS1061: 'System.Web.UI.WebControls.GridViewCommandEventArgs' does not contain a definition for 'Row' and no extension method 'Row' accepting a first argument of type 'System.Web.UI.WebControls.GridViewCommandEventArgs' could be found (are you missing a using directive or an assembly reference?),,this error is comming
TrushnaK 3-Feb-14 0:08am    
can you post your code.. what you have tried. or what is your exact scenario with details.

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