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 3425386
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:35:15+00:00 2026-05-18T06:35:15+00:00

I have a user control with a number of methods. I also have a

  • 0

I have a user control with a number of methods. I also have a dataset object that I’m filling in one method, but I also need to access that same dataset (and the data in it) in another.

I am filling the dataset from some xml that I get from a webservice when someone clicks on a button. The data from the dataset is then bound to a listbox control. When someone selects an item in the list control (I have autopostback set to true on it) it then fires off another method and it’s this method where I need to access the data in the dataset, but when I check the immediate window it’s telling me that the dataset is set to null.

Where am I going wrong?

Edited to add psuedocode

//Dataset 
DataSet dsAddress;

protected void Page_Load(object sender, EventArgs e)
{
    // Nothing happens to DataSet here
}
protected void btnPostCode_Click(object sender, EventArgs e)
{
    try
    {
        // Dataset has data added here
    }
    catch (Exception ex)
    {
        lblError.Text = ex.Message.ToString();
    }
    if (!DataHelper.DataSourceIsEmpty(dsAddress))
    {
       //Dataset bound to listbox here
    }

}  

protected void lstAddressDropdown_SelectedIndexChanged(object sender, EventArgs e)
{
    // Need to access dataset here       
}
  • 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-18T06:35:16+00:00Added an answer on May 18, 2026 at 6:35 am

    If the data is the same across all users of the system (irrespective of session), make the dataset static or store in the Application object.

    Otherwise, if it is per-session, store in the Session object but do not forget to clean up after it is not needed any longer.

    In my opinion, it is unwise to store it in the viewstate as that will create much additional traffic, and will slow down the system with serialization and deserialization.

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

Sidebar

Related Questions

I have a user control that has a few public properties, one is an
I have a user control with a UniformGrid that has a number of Buttons.
I have a WPF user control with a number of textboxes, this is hosted
I have a user control that I've created, however when I go to add
I have a user control with a More Info link. When clicking that link,
I have a user control that takes a several seconds to load. Is there
If I have a custom user control (say, MyCustomControl.ascx) which contains a number of
I have a user control which has a number of properties. This user control
I have an application that uses Spring Security to control access to pages, to
I have an user control, which contains multiple methods and each of these methods

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.