sheng Posted July 20, 2009 Report Share Posted July 20, 2009 I'm using the chart1.Data.Compact() with a drop down list to compact my data. The data will get compact the first time I select a frequency (for example: weekly). However, it will show a "Object reference not set to an instance of an object." error when I select another frequency. Could some body help me please? Here is my code: <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"> <asp:ListItem Selected="True">Daily</asp:ListItem> <asp:ListItem>Weekly</asp:ListItem> <asp:ListItem>Monthly</asp:ListItem> </asp:DropDownList><uc1:Charts ID="chart1" runat="server" /> private void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { switch (DropDownList1.Text) { case "Daily": chart1.Data.Compact(1); break; case "Weekly": chart1.Data.Compact(7); break; case "15-days": chart1.Data.Compact(15); break; case "Monthly": chart1.Data.Compact(30); break; case "Yearly": chart1.Data.Compact(365); break; } } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.