ASP.NET - Chart MajorGrid LineColor

Chart MajorGrid LineColor
ChartMajorGridLineColor.aspx

<%@ Page Language="C#" AutoEventWireup="true" %>
<%@Import Namespace="System.Web.UI.DataVisualization.Charting" %>

<!DOCTYPE html>

<script runat="server">
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        Chart1.ChartAreas[0].AxisX.MajorGrid.LineColor = System.Drawing.Color.Red;
        Chart1.ChartAreas[0].AxisY.MajorGrid.LineColor = System.Drawing.Color.Green;
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>How to set change Chart MajorGrid LineColor programmatically in asp.net</title>
    <style type="text/css">
        h2
        {
            color:DarkBlue;
            font-style:italic;
            }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2>Chart example and tutorial: How to set change<br /> Chart MajorGrid LineColor programmatically in asp.net</h2>
        <hr width="525" align="left" color="DarkBlue" />
        <br />
        <asp:Chart 
            ID="Chart1" 
            runat="server"
            Width="525" 
            BackColor="Snow"
            BorderlineColor="IndianRed"
            BorderlineDashStyle="Solid"
            >
            <Series>
                <asp:Series 
                    Name="AnnualSalary" 
                    YValueType="Int32" 
                    ChartArea="DefaultChartArea"
                    XValueType="Single"
                    Color="MediumOrchid"
                    >
                    <Points>
                        <asp:DataPoint AxisLabel="Munni" YValues="37400" />
                        <asp:DataPoint AxisLabel="Monalisa" YValues="19695" />
                        <asp:DataPoint AxisLabel="Atonu" YValues="21250" />
                        <asp:DataPoint AxisLabel="Sarothi" YValues="9850" />
                        <asp:DataPoint AxisLabel="Santonu" YValues="17250" />
                    </Points>
                </asp:Series>
            </Series>
            <ChartAreas>
                <asp:ChartArea 
                    Name="DefaultChartArea" 
                    BackColor="PapayaWhip"
                    >
                    <Area3DStyle Enable3D="true" />
                </asp:ChartArea>
            </ChartAreas>
        </asp:Chart>
        <br />
        <asp:Button 
            ID="Button1"
            runat="server"
            Text="Change Chart MajorGrid LineColor"
            Font-Bold="true"
            OnClick="Button1_Click"
            ForeColor="DarkBlue"
            Height="45"
            />
    </div>
    </form>
</body>
</html>
More asp.net chart examples