Jump to content
Software FX Community

Lose object reference when using Data.Compact()


Recommended Posts

 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;   }     }

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...