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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:43:29+00:00 2026-06-09T04:43:29+00:00

I need a hand on this basic topic since I’m pretty new to webpages.

  • 0

I need a hand on this basic topic since I’m pretty new to webpages.

protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            UserLogin ObjUser = new UserLogin();
            Persona ObjPersona = new Persona();
            DataSet ds = new DataSet();
            string UserName = null;
            UserName = WindowsIdentity.GetCurrent().Name;
            UserName = Regex.Replace(UserName, ".*\\\\(.*)", "$1", RegexOptions.None);                
            ds = ObjUser.GetUserData(UserName);
            ObjPersona.UserName = UserName;
            ObjPersona.RealName = ds.Tables[0].Rows[0][0].ToString();
            ObjPersona.Ranking = ds.Tables[0].Rows[0][1].ToString();
            if (((bool)ds.Tables[0].Rows[0]["TNT"] == false)) ObjPersona.TNT = false;
            else ObjPersona.TNT = true;
            if (((bool)ds.Tables[0].Rows[0]["TLG"] == false)) ObjPersona.TLG = false;
            else ObjPersona.TLG = true;
            if (((bool)ds.Tables[0].Rows[0]["NEG"] == false)) ObjPersona.Negocios = false;
            else ObjPersona.Negocios = true;
            if (((bool)ds.Tables[0].Rows[0]["RES"] == false)) ObjPersona.Residenciales = false;
            else ObjPersona.Residenciales = true;
            if (((bool)ds.Tables[0].Rows[0]["BO"] == false)) ObjPersona.BO = false;
            else ObjPersona.BO = true;
            if (((bool)ds.Tables[0].Rows[0]["BOA"] == false)) ObjPersona.BOA = false;
            else ObjPersona.BOA = true;
            ObjUser.CreateRegister(ObjPersona);
        }
    }

A simple execution once the page is loaded. A Stored procedure fills a DataSet and then I use the dataset to place the data into the Object, in this case ObjPersona.

Now, when I intend to use ObjPersona in another call, let’s say.

protected void BtnClose_Click(object sender, EventArgs e)
    {            
        ObjUser.UpdateRegister(ObjPersona);
        LblClose.Text = "Sesión Cerrada";
    }

It won’t work since there’s no data in there. (hits error once I want to use data from within the object)

I want to call the procedure for getting the user data just once (this case the page_load), and from there work with it. How can I access data recalled in another control?

Thanks.

  • 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-06-09T04:43:30+00:00Added an answer on June 9, 2026 at 4:43 am

    A new instance of the asp.net Page object is created for every request. Every time you postback to a page, the Init, Load, eventhandlers are called. You are not dealing with the same object.

    If you populated a member variable during the last request, it will not be available this time.

    You need to use some means to persists you data across Postbacks.

    Asp.net provides two inbuilt methods to do this. One is the ViewState and the other is the Session. Session varialbes are stored on the server, and ViewState data is stored in a hidden input variable in the form.

    If you have a lot of data in that DataSet, avoid putting it in the ViewState. It would create a large ViewState and make your page loads slow.

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

Sidebar

Related Questions

I need a quick hand figuring out what this code is doing, and how
I'm new to php and I need a hand. I have width by height
I guess this is going to sound like a pretty basic question to any
I need a hand making this code below working. I've had it working so
I am stuck and in need of a hand. Hope someone can help? Anyone
I need to get the left hand side integer value from a decimal or
I have following array, that I need to operate by hand on bitmaps. const
Need to apply a filter to a file like this: TUPAC_0006:1:1:2554:2356#0/1 0 * 0
Need a map reduce function by mongo in php This my mongo structure [_id]
this question may seem too basic to some, but please bear with be, it's

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.