Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Accessing the public event delegate from user control to page

Posted on 2013-06-27
1
Medium Priority
?
253 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

719 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