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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:45:06+00:00 2026-06-17T08:45:06+00:00

I have a usercontrol page which has a label on it and the onLoad

  • 0

I have a usercontrol page which has a label on it and the onLoad code for the label is written in C#. The page I added the usercontrol to has a button. Is there any way for me to code the usercontrol so that it changes the label in response to the button press? Preferably this would be done from the usercontrol page in C#. I’m not sure if it would affect anything about this but the non-usercontrol page has the code behind done in VB.

Thanks for any insight on this.

  • 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-17T08:45:07+00:00Added an answer on June 17, 2026 at 8:45 am

    In the code for your Page.aspx add a declarative event handler for the button click and add the following code within it alongside the other logic-

    C#

    Protected void Button_OnClick(object sender, eventargs e)
    {
       //Other logic responding to the click event within the page
       LabelUserControl.PageButton_Click(sender, e); 
    }
    

    VB.NET

    Protected Sub PageButton_Click(sender As Object, e As System.EventArgs) Handles PageButton.Click 
       LabelUserControl.PageButton_Click(sender, e)
    End Sub
    

    or (if the user control label change is the only response to the click)-

    C#

    Protected void Page_Load(object sender, eventargs e)
    {
       PageButton.Click += LabelUserControl.PageButton_Click;
    }
    

    VB.NET

    Sub Page_Load(ByVal Sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        AddHandler PageButton.Click, AddressOf LabelUserControl.PageButton_Click
    End Sub
    

    In your user control-

    public void PageButton_Click(object sender, eventargs e)
    {
      // change label text
    }
    

    The method should be public so it can be accessed from the page.

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

Sidebar

Related Questions

Lets say I have a page, which has one usercontrol (A) on it. This
I have an aspx page that inherits a master page which has a protected
I have a parent page Page1 which has button1. Page1 has a usercontrol uc1.
I have a page with a UserControl (in which linkbuttons are dynamically created). On
I have a datalist inside a usercontrol that gets loaded into a page where
I have a user control...and the base page(s) which uses this user control has
I have a contest form that is a usercontrol, it sits on page that
I have an UserControl which has listbox. I put this UserControl on the Mainpage.xaml.
I have an aspx page which has the following: A repeater with a linkbutton
I have a user control which has a textbox on it, now this usercontrol

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.