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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:47:29+00:00 2026-06-08T07:47:29+00:00

I have a User Control with with some search functionality, then I also have

  • 0

I have a User Control with with some search functionality, then I also have a control that contains a grid. In the control that has the grid I have all the functionality to retrieve some items I need to populate a report from the search control.

My question is, and I have read about this but not completely sure how to make it work, I read i need to register a event handler in control A that calls the function in control B. How does that work?

Say in control B there is a function that I need to call GetAllItemsByRegistrantID(int id). How can I make a call to this function from control A?

I would really appreciate any help or guidance on this.

Regards

  • 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-08T07:47:30+00:00Added an answer on June 8, 2026 at 7:47 am

    Here is an example if you had to do it using events.

    On your first user control (the search control) define a custom event.

    public partial class UserControl1 : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
    
        }
    
        public event EventHandler<MyCustomeEventArgs> MyCustomClickEvent;
    
        protected virtual void OnMyCustomClickEvent(MyCustomeEventArgs e)
        {
            if (MyCustomClickEvent != null)
                MyCustomClickEvent(this, e);
    
        }
    
        public void button1_Click(object sender, EventArgs e)
        {
            OnMyCustomClickEvent(new MyCustomeEventArgs(5));
        }
    
    }
    public class MyCustomeEventArgs : EventArgs
    {
        public MyCustomeEventArgs(int searchID)
        {
            SearchID = searchID;
        }
        public int SearchID { get; set; }
    
    }
    

    On your user control with the grid, define a handler.

    public void HandleCustomEvent(object sender, MyCustomeEventArgs e)
    {
        GetAllItemsByRegistrantID(e.SearchID);
    }
    
    public void GetAllItemsByRegistrantID(int id)
    {
        Label1.Text = id.ToString();
    }
    

    On the page where they both live, wire them together.

    protected void Page_Load(object sender, EventArgs e)
    {
        UserControl1Instance.MyCustomClickEvent += UserControl2Instance.HandleCustomEvent;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple user control that contains some buttons that fire events which
I have a User Control displaying some data and a button that displays a
I have some javascript that manipulates html based on what the user has selected.
I have a Silverlight user control that is a textbox with a search button
I have a user control which uses objects as inner properties (some code is
I have got 5 user controls placed in some Control folder, at run time
I have some control like <ListBox ItemsSource={Binding tests, UpdateSourceTrigger=PropertyChanged} ItemTemplate={StaticResource TestTemplate} /> When user
I have a search form: <form class=searchForm id=topSearchForm action=/search.ds> that has an onsubmit-event attached
I have made one custom user control (search text box), which basically consists of
I'm making what is basically a toolbar that contains a search field and some

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.