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

  • Home
  • SEARCH
  • 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 899747
In Process

The Archive Base Latest Questions

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

Say aspx page called theParent has a DataGrid control named theDataGrid and a UserControl

  • 0

Say aspx page called theParent has a DataGrid control named theDataGrid and a UserControl named theUserControl , and theUserControl has a button named theUcButton .

Yes, I know, very imaginative naming.

When theUcButton is clicked , a session variable is changed.

This session variable is a select parameter for the datasource of theDataGrid.

However, because of the order of stuff called in the page lifecycle, when theUcButton is clicked and a postback is generated ,
theParent controls are loaded before theUserControl resets the session variable, and theDataGrid does not show the new data until the next postback .

How to I get what I want to work?

I am using 3.5 if that matters.

  • 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-15T15:16:19+00:00Added an answer on May 15, 2026 at 3:16 pm

    Here is example code for your user control to raise an event.

    public partial class WebUserControl : System.Web.UI.UserControl{
    public event EventHandler Updated;
    
    protected void Button1_Click(object sender, EventArgs e)
    {
        //do some work to this user control
    
        //raise the Updated event
        if (Updated != null)
            Updated(sender, e);
    }}
    

    Then from your .aspx page, you’ll deal with the new event just like usual

        <uc1:WebUserControl ID="WebUserControl1" runat="server" OnUpdated="WebUserControl1_Updated" />
    

    Code behind:

    protected void WebUserControl1_Updated(object sender, EventArgs e)
    {
        //handle the user control event
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom control in an aspx page that has a property named
Here's the scenario I have a page lets say login.aspx having a button called
Let's say I have an aspx page with this calendar control: <asp:Calendar ID=Calendar1 runat=server
Let's say I have a page view called PagePreview.aspx . on that page I've
I have an aspx page with a usercontrol say UC1. UC1 is using another
I have a user control named lets say ucName that has a property named
I have a base page called let's say Login.aspx with Login.aspx.cs code behind. Now...I
Say I have a web site with a master page and an aspx page.
I have a content page(Say.. invoice.aspx) in asp.net application with master pages. The content
I have a page request with a QueryString, say http://www.xyz.net/Orders.aspx?OrderID=1 . The page is

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.