Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6577431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:38:06+00:00 2026-05-25T15:38:06+00:00

I am working on a ASP.NET/C# Website. I am reading data from a database,

  • 0

I am working on a ASP.NET/C# Website.

I am reading data from a database, saving it in a Dictionary

Dictionary<string, decimal> Results

and then binding it to a ASP.NET chart

PieChart.Series["Series"].Points.DataBind(Results, "Key", "Value", string.Empty);  

I want to change the Label of a Point when I click a button.

protected void Button_Click(object sender, EventArgs e)
{
    PieChart.Series["Series"].Points[0].Label = "abc"
}

But the problem when I click the button, a PostBack happens and the data saved in The “Results” Dictionnary is lost as well as the Chart.

Is there a way to , not lose the data when a postback happens without having to read from the database all over again?

Thank you for any help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:38:07+00:00Added an answer on May 25, 2026 at 3:38 pm

    Yes Make use of ViewState to preserve data between postback.

    public Dictionary<string, decimal> Results
    { 
      get { return ViewState["Results"]; }
      set { ViewState["Results"] = value; }
    }
    

    Note:
    Check for the Null value of viewstate otherwise it will throw an Exception or Error

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently working on an ASP.NET Website where I want to retrieve data from
I'm working on an ASP.Net project to display information on a website from a
Im working on asp.net website. In some pages I'm saving the datatable into chache
I am working on an ASP.Net website and have a GridView displaying some data,in
I'm working on an Asp.net website (it's been awhile) coming from an MVC background.
I am working on asp.net website with sql database which provides membership support. After
I am working with asp.net website project that some of pages need authentication. I
I'm working on an ASP.NET website which targets desktop browsers. We want to enable
I'm working on an ASP.NET website where I am using an asp:repeater with paging
Right now I'm working with an ASP.NET website that automatically generates images and stores

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.