Hiding The Gridlines On An ASP.Net Chart Control Hiding The Gridlines On An ASP.Net Chart Control asp.net asp.net

Hiding The Gridlines On An ASP.Net Chart Control


Set the Axis.MajorGrid.Enabled property to false for the x and y axes:

Chart1.ChartAreas["YourChartArea"].AxisX.MajorGrid.Enabled = false;Chart1.ChartAreas["YourChartArea"].AxisY.MajorGrid.Enabled = false;


Its more simple than above . All you need to do is add the following lines in your aspx pageinside your chartarea , since you are using chart control.

            <chartareas>                            <asp:ChartArea Name="ChartArea1">                                <axisy>                                    <MajorGrid Enabled ="False" />                                </axisy>                                <axisx>                                    <MajorGrid Enabled="false"/>                                </axisx>                            </asp:ChartArea>

You can also set the Mazor grid line width property to zero to see the same output :-

          <chartareas>                            <asp:ChartArea Name="ChartArea1">                                <axisy>                                    <MajorGrid LineWidth="0" />                                </axisy>                                <axisx>                                    <MajorGrid LineWidth="0"/>                                </axisx>                            </asp:ChartArea>