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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:00:30+00:00 2026-05-27T18:00:30+00:00

So I have some information I show a user about their account. However, an

  • 0

So I have some information I show a user about their account. However, an administrator can see this page, and decide to click “Activate” or “Deactivate” on a user.

Expected behavior:
If the administrator presses Activate on an inactive account, the information queries the database and displays at the top that the user’s account is active. And the success message is displayed.

The current behavior:
If the administrator presses Activate on an inactive account, the information doesn’t requery, it still says the user’s account is INACTIVE. And the success message is displayed.

I’m using OnClick and runat=”server” on the buttons. And the information table that queries the database is in Page_Load(). I’m not using the “IsPostBack” or anything, so it should refresh the information.

Do I have to put a “Reload()” or “Refresh()” or “DataBind()” type function at the end of my “btnUpdate_OnClick(object sender, EventArgs e)” function? How would I do this?

I just don’t understand why the event lifecycle won’t just reload the page completely.

EDIT:

Some simplified code:

protected void Page_Load(object sender, EventArgs e)
  {

      if (Request["uid"] != null)
          userID = Int32.Parse(Request["uid"]);

      UserDAO ud = new UserDAO();
      tblUser u = ud.GetUser(userID);
      AccountStatus.Text = (((Boolean)u.ActiveOrNot) ? "Active" : "Inactive") + "<br />";

 }

 protected void btnActivate_OnClick(object sender, EventArgs e)
  {
      UserDAO udao = new UserDAO();
      int userBeingEdited = -1;

      if (Request["uid"] != null)
      {
          userBeingEdited = Int32.Parse(Request["uid"]);
      }
      if (udao.ActivateUser(userBeingEdited))
      {
          DisplayError("This user has been activated.", true);
      }
 }

Where AccountStats is a Asp:label. And GetUser queries the database.

That’s all the relevant code.

I’m wondering why Onclick doesn’t refresh the page and reload Page_Load() function!!

  • 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-27T18:00:31+00:00Added an answer on May 27, 2026 at 6:00 pm

    OnLoad fires before event handlers like btnActivate_OnClick. Since you are displaying status in OnLoad, the changes made in the button’s click event won’t be reflected until the next page load.

    You can put the code which displays the status into OnPreRender, which fires after event handlers, or you can add an additional method to display status.

    private int _uid;
    
    protected void Page_Load( object sender, EventArgs e )
    {
        if( Request["uid"] != null )
        {
            _uid = Int32.Parse( Request["uid"] );
        }
        else
        {
            throw new InvalidOperationException( "uid parameter is missing." );
        }
    
        DisplayStatus();
    }
    
    private void DisplayStatus()
    {
        UserDAO ud = new UserDAO();
        tblUser u = ud.GetUser( _uid );
        AccountStatus.Text = ( ( (Boolean)u.ActiveOrNot ) ? "Active" : "Inactive" ) + "<br />";
    }
    
    protected void btnActivate_OnClick( object sender, EventArgs e )
    {
        UserDAO udao = new UserDAO();
        int userBeingEdited = -1;
    
        if( _uid > default( int ) )
        {
            userBeingEdited = _uid;
        }
        if( udao.ActivateUser( userBeingEdited ) )
        {
            DisplayError( "This user has been activated.", true );
        }
    
        DisplayStatus();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an article list page. It needs to show some content information about
I have to develop an application that display some information about the possessor of
Hi I have an user model and I also have some fields for their
show databases shows all databases where you (logged in user) have some privileges. Is
Trying to get some information to the user about disabledDays in datepicker. I want
I have some information in my database like 'author', 'book' etc., that are all
I have some XML files that contain different function information. I am trying to
I have tried to get some information from W3C regarding the update of an
I have a hashmap with some information(key and value) in a perl file. I
I have a LI with some information, including some links. I would like jQuery

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.