c# - Change GridView row color based on condition -


i want change particular row color of gridview based on condition, using asp.net c#. thank you.

protected void gridview1_rowdatabound(object sender, gridviewroweventargs e) {     e.row.attributes.add("style", "cursor:help;");     if (e.row.rowtype == datacontrolrowtype.datarow && e.row.rowstate == datacontrolrowstate.alternate)     {          if (e.row.rowtype == datacontrolrowtype.datarow)         {                             e.row.attributes.add("onmouseover", "this.style.backgroundcolor='orange'");             e.row.attributes.add("onmouseout", "this.style.backgroundcolor='#e56e94'");             e.row.backcolor = color.fromname("#e56e94");                         }                }     else     {         if (e.row.rowtype == datacontrolrowtype.datarow)         {             e.row.attributes.add("onmouseover", "this.style.backgroundcolor='orange'");             e.row.attributes.add("onmouseout", "this.style.backgroundcolor='gray'");             e.row.backcolor = color.fromname("gray");                         }          //e.row.cells[0].backcolor = color.fromname("gray");         //e.row.cells[1].backcolor = color.fromname("gray");         //e.row.cells[2].backcolor = color.fromname("gray");         //e.row.cells[3].backcolor = color.fromname("gray");         //e.row.cells[4].backcolor = color.fromname("gray");         //e.row.borderwidth = 2;         //e.row.bordercolor = color.fromname("#43c6db");     } } 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -