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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:40:50+00:00 2026-06-01T17:40:50+00:00

I am using this to transfer values from ascx codebehind to ascx user control

  • 0

I am using this to transfer values from ascx codebehind to ascx user control which has 3 Labels

 string text1 = fr.data[0].name;
        string text2 = m.data[0].name;
        string text3 = m.data[0].name;
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), " ", "document.getElementById('lblfriend').innerHTML ='" + text1 + "'; return true;", true);
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), " ", "document.getElementById('lblmyname').innerHTML ='" + text2 + "'; return true;", true);
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), " ", "document.getElementById('lblmyname1').innerHTML ='" + text3 + "'; return true;", true);

However values aren’t getting passed and i want to render those Labels as Html so that they can be embedded in an email

Please help!

  • 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-01T17:40:51+00:00Added an answer on June 1, 2026 at 5:40 pm

    You could expose the label text as string properties in the codebehind of the UserControl. Then when you render the usercontrol, pass the values to it and it would render the text of the labels.

    Codebehind for the UserControl:

    public partial class WebUserControl1 : System.Web.UI.UserControl
    {
        private string _Friend;
    
        public string Friend
        {
            get
            {
                return _Friend;
            }
            set
            {
                _Friend = value;
                lblfriend.Text = value;
            }
        }
    
        private string _MyName;
    
        public string MyName
        {
            get
            {
                return _MyName;
            }
            set
            {
                _MyName = value;
                lblmyname.Text = value;
                lblmyname1.Text = value;
            }
        }
    
    }
    

    Then you could load your values as such in your parent control/page:

            string text1 = fr.data[0].name;
            string text2 = m.data[0].name;                    
            MyUserControl.Friend = text1;
            MyUserControl.MyName = text2;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this method to transfer files using a FTP Server: private void TransferNeededFiles(IEnumerable<string>
Using this tutorial at section 5.5, I attempted to Assign the 'celsius' string attribute
We are using the following routine (on Linux, with libudev) to read data from
I have a data.frame in R which has been constructed off the Example 1-3
My code copies files from ftp (using text transfer mode) to local disk and
I am trying to transfer data from one page to another but some problem
I want to get data from a DMA enabled, PCIe hardware device into user-space
For my current project in c# I need to transfer data from a SQL-Database
I want to transfer a String value from one class to another class in
Using this file as source, I have a situation where I need to retrieve

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.