Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Accessing the public event delegate from user control to page

Posted on 2013-06-27
1
Medium Priority
?
254 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

926 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