Solved

Accessing the public event delegate from user control to page

Posted on 2013-06-27
1
250 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

Technology Partners: 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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

739 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