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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:34:37+00:00 2026-06-03T00:34:37+00:00

I have a table with all the objects I have in my db. I

  • 0

I have a table with all the objects I have in my db. I load them in my Page_Load function. I have a text field and a button that when clicking the button, I want the handler of that click to put a new object with the name written in the text field in the db.

Now, I want that what happens after the click is that the page loads again with the new item in the table. The problem is that the button event handler is run after the Page_Load function.

A solution to this would be to use IsPostBack in the Page_Load or use the pre load function. A problem is that if I would have 3 different buttons, I would have to differ between them there instead of having 3 different convenient functions.

Any solutions that don’t have this problem?

Code:

protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["userId"] == null)
                Response.Redirect("Login.aspx");

            // LOAD DATA FROM DB
        }

        protected void CreateObject(object sender, EventArgs e)
        {
            // SAVE THE NEW OBJECT
        }
  • 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-03T00:34:38+00:00Added an answer on June 3, 2026 at 12:34 am

    Maybe you should try loading your data during PreRender instead of Load

        protected void Page_Load(object sender, EventArgs e)
        {
            this.PreRender += Page_PreRender
            if (Session["userId"] == null)
                Response.Redirect("Login.aspx");
        }
    
        protected bool reloadNeeded {get; set;}
    
        protected void CreateObject(object sender, EventArgs e)
        {
            // SAVE THE NEW OBJECT
            reloadNeeded = true;
        }
    
    
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if(reloadNeeded || !IsPostBack)
            // LOAD DATA FROM DB
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a draggable table which all working fine, though I want to be
I have a Pages table that stores all my view urls and this table
I have a User table that has all of their avatars saved in an
I have a table (participants) which has multiple columns that could all be distinct.
I have a table with all U.S. zip codes. each row contains the city
I have a MYSQL table with all of the visitors to my website. Each
I have a table with 18 columns (all Ints) and 1040 rows. If any
I have a table and I need to count all unique users on it.
Can a fact table have no keys at all? or if it can, is
I have a package that imports 7 csv files and loads them into 7

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.