><asp:GridView ID="grdDeleteUsers" runat="server" AutoGenerateColumns="False" > CellPadding="4" > DataKeyNames="UserName" AllowSorting="True" > ForeColor="#333333" GridLines="None" ToolTip="Select user to Delete" > OnRowDataBound="grdDeleteUsers_RowDataBound" > Width="379px" > DataSourceID="odsDeleteGrid" AllowPaging="True" PageSize="5" > OnRowCreated="grdDeleteUsers_RowCreated"> > <RowStyle BackColor="#F7F6F3" ForeColor="#333333" /> > <EditRowStyle BackColor="#999999" /> > <SelectedRowStyle Backcolor="LightCyan" ForeColor="DarkBlue" Font-Bold="True"/> > <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /> > <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> > <AlternatingRowStyle BackColor="White" ForeColor="#284775" />>
><asp:GridView ID="grdvwUsers" runat="server" AutoGenerateColumns="False" CellPadding="4" > ForeColor="#333333" GridLines="None" AllowPaging="True" PageSize="5" > OnSelectedIndexChanged="grdvwUsers_SelectedIndexChanged" > OnRowDataBound="grdvwUsers_RowDataBound" OnPageIndexChanging="grdvwUsers_PageIndexChanging" > OnRowCreated="grdDeleteUsers_RowCreated">
>protected void grdDeleteUsers_RowCreated(object sender, GridViewRowEventArgs e) > { > //Colors charts - see http://www.1netcentral.com/color-chart.html > string onmouseoverStyle = "this.style.backgroundColor='#0bf'"; // Deepskyblue > > string onmouseoutStyle = "this.style.backgroundColor='@BackColor'"; > > string rowBackColor = String.Empty; > GridView grd = (GridView)sender; > if (e.Row.RowType == DataControlRowType.DataRow) > { > > if (e.Row.RowState == DataControlRowState.Alternate) > > rowBackColor = System.Drawing.ColorTranslator.ToHtml(grd.AlternatingRowStyle.BackColor).ToString(); > > else rowBackColor = System.Drawing.ColorTranslator.ToHtml(grd.RowStyle.BackColor).ToString(); > > e.Row.Attributes.Add("onmouseover", onmouseoverStyle); > > e.Row.Attributes.Add("onmouseout", onmouseoutStyle.Replace("@BackColor", rowBackColor)); > > } > }>