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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T13:51:14+00:00 2026-05-11T13:51:14+00:00

I have a Page (form) that has many UserControls on it, and I’m trying

  • 0

I have a Page (form) that has many UserControls on it, and I’m trying to have a single button to save everything. The UserControls are actually nested, so I wanted to somehow signal to each UC that it should save itself, instead of somehow wrapping everything into one event or having a single event trigger a cascade of save events.

My plan was to use a static class (props to this answer for the code):

public static class RequestScopedFormData {     private const string save_key = 'request_form_is_saving';      public static bool FormIsSaving     {         get         {             object o = HttpContext.Current.Items[save_key];             return Convert.ToBoolean(o);         }         set         {             HttpContext.Current.Items[save_key] = value;         }     } } 

Ideally a button on my MasterPage would set RequestScopedFormData.FormIsSaving = true, and as .NET builds the Page and its UserControls, they would know to perform a save on themselves.

The problem I’m having is that I can’t get an event to fire early enough in the Page lifecycle to save the UserControls. Even if I move the saving code to the PreRender event, and I move the save ImageButton to the Page itself (instead of the MasterPage), I cannot get the FormIsSaving set to true before the UC saving check.

It happens something like this:

  • Page Page_Load
  • MasterPage Page_Load
  • UC Page_Loads and PreRenders (they are mixed, it prerenders some before it loads others)
  • MasterPage SaveButton_Click event (this is where I set my class variable)
  • MasterPage PreRender
  • Page PreRender

So unfortunately the SaveButton_Click method happens AFTER the UCs are loaded, so they never save.

  • 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. 2026-05-11T13:51:14+00:00Added an answer on May 11, 2026 at 1:51 pm

    You can also check if postback was caused by the save button:

    Request.Form['__EVENTTARGET'].Contains({YourSaveButton}.UniqueID) 

    The form variables are available earlier in the page life cycle.

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

Sidebar

Related Questions

I have A single page that has the following structure <form runat=server><placeholder></placeholder></form> I have
I have a page that has several ajax submission forms. Each form has a
I have a form that has many checkboxes (too many for it to make
I have a model Patients that has many Healthplans . I'm trying to update
I have a page with a form that is submittes via ajaxSubmit() (so, without
I have a page with a form on it that needs to post to
I have a form page in PHP that reads a DBF, and conditionally converts
I have a form that auto submits and updates the same page. I have
I have a form that when submitted successfully generates new elements on the page
I have a form that I don't render as part of HTML page but

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.