Solved

Accessing the public event delegate from user control to page

Posted on 2013-06-27
1
241 Views
Last Modified: 2013-09-28
having assigned the public event and delegate in the user control,

trying to subscribe the method to local aspx page (that uses the user control) to local delegate , then assign the value (from user control) to local aspx page's text box.

unfortunately, having prob calling the sendMsg with _uc.sendMsg.

  //_uc.sendMsg += delegate(string message)
            // {

            //     lblUserControlTextBoxValue.Text = message;

            // };


protected void Page_Load(object sender, EventArgs e)
        {
            lbl02.Text = Master.HeaderValue.ToString();

            UserControl _uc = (UserControl)Master.FindControl("UC01");

            
            
            //_uc.sendMsg += delegate(string message)
            // {

            //     lblUserControlTextBoxValue.Text = message;

            // };
        }

Open in new window


ascx

public event SendMessageDelegate sendMsg;

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btn01_Click(object sender, EventArgs e)
        {
            decimal dec01 = Convert.ToDecimal(txt01.Text);

            decimal dec02 = Convert.ToDecimal(txt02.Text);

            decimal dectotal = dec01 + dec02;

            if (sendMsg != null)
            {
                sendMsg(dectotal.ToString());
            }


            //lblusercontrol01.Text = dectotal.ToString();
        }

Open in new window

0
Comment
Question by:doramail05
1 Comment
 
LVL 1

Accepted Solution

by:
doramail05 earned 0 total points
ID: 39530669
Found out that the findcontrol(uc01), the name in the bracket is irrelevant
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now