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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:11:33+00:00 2026-06-12T14:11:33+00:00

I use an ascx user control for manage CRUD o database entity. I reuse

  • 0

I use an ascx user control for manage CRUD o database entity. I reuse this userc control in my aspx page for show in readonly mode the database data of a record on database. The user control have inside a simple FormView and an objectdatasource.

Now, in a aspx page that contains that ascx i have to know, in DATABIND time of the aspx some data of the record of the database that is considerate by the user control. User control are databind after the aspx page, and for this reason i don’t have the data. I have to do a select in aspx page on database and after the user control do the same select.

How can i do for optimize this process?

  • 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-12T14:11:34+00:00Added an answer on June 12, 2026 at 2:11 pm

    ASCX base events may be fired after your ASPX’s base events, but in the whole lifecycle, you can fire your own events.

    You could define an Event on your ASCX, make your page register to this event, and then propagate your custom event from your ASCX to your ASPX, with whatever data you need in the arguments

    rough example (may not compile) : in the ASCX

    public partial YourControl : System.Web.UI.UserControl {
        public event EventHandler MyControlDataBound;
        public void FireMyControlDataBound()
        {
            if (MyControlDataBound!= null)
            {
                MyControlDataBound(this, new EventArgs());
            }
        }
    
        protected void MyDataBound(object sender, EventArgs e) {
            // ......
            FireMyControlDataBound();
        }
    }
    

    and in the ASPX

    public partial class MyPage: Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            yourUserControlInstance.MyControlDataBound += HandleYourDataInYourPage;
        }
    
        protected void HandleYourDataInYourPage(object sender, EventArgs e) {
            // .. do whatever needed in your page, with your data
            // if you have defined a custom Args class that inherits EventArgs, your could collect data here...
        }
    }
    

    Feel free to create a class that inherits EventArgs to pass data with your event if you need this

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

Sidebar

Related Questions

I have an ascx user control with and Entity Framework IQueryable property like this:
For example, I have a user control(ascx) with a label inside, I will use
I've got a user control that should use caching, with VaryByControl . The .ascx
I am trying to use the Page_LoadComplete in my user control myusercontrol.ascx.cs but its
I want my asp.net .ascx user control to use some javascript. How to do
I'm stumped! We have a user control for managing account information. We use this
I have a user control ( gallery.ascx ) and I want to use the
Is there a way to include some aspx/ascx markup in a DLL and use
Use Case Show a photo uploaded by the user in a square box with
How can I pass user control properties to the page AND make these properties

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.