R. Bandi R. Bandi - 27 days ago 6
ASP.NET (C#) Question

asp.net c# Change gridview row color after updating data

I'm working on asp.net project and I am using a GridView with

SqlDataSource
.
I have edit enabled on the GridView, so I want the row color to be changed after admin edit and update the row. How can I do that?

Answer Source

Nest an <AlternatingRowStyle> element between the opening and closing tags of your GridView.

<asp:GridView ID="GridView1" runat="server" >
    <Columns>
    </Columns>

    <AlternatingRowStyle BackColor="DarkRed" 
      ForeColor="DarkBlue"
      Font-Italic="true" />
</asp:GridView>

Link: https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.alternatingrowstyle(v=vs.110).aspx