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

  • SEARCH
  • Home
  • 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 4008060
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:42:27+00:00 2026-05-20T08:42:27+00:00

I have 3 ASPX pages. A usercontrol on each page has an email placeholder

  • 0

I have 3 ASPX pages. A usercontrol on each page has an email placeholder in it. What I want to achieve is when the customer clicks on the usercontrol email placeholder, certain methods on a particular page should trigger.

See below for the code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using Tangent.Breakingfree;

public partial class uc_ucBottomMenu : System.Web.UI.UserControl
{

    public string printUrl { get; set; }
    public string emailUrl { get; set; }
    public string audioUrl { get; set; }
    public bool myDaigram { get; set; }
    public bool toolbox { get; set; }

    public uc_ucBottomMenu() {

        myDaigram = true;
        toolbox = true;

    }

    public Action<object, EventArgs> MyEvent;
    protected void Page_Load(object sender, EventArgs e)
    {
        btnTriggerEvent.Click += new EventHandler(btnTriggerEvent_Click);
    }

    void btnTriggerEvent_Click(object sender, EventArgs e)
    {
        MyEvent(sender, e);
    }

    protected void Page_PreRender(object sender, EventArgs e)
    {
        Page.ClientScript.RegisterClientScriptInclude("bottomMenu", "../js/jqDock.js");

        // bit of an oppositen as always late request from client
        // saves going through all pages!!!

        phDiagram.Visible = myDaigram;

        phToolbox.Visible = toolbox;

        if (string.IsNullOrEmpty(printUrl))
        {
            phPrint.Visible = false;
        }
        else
        {
            phPrint.Visible = true;
            hplPrint.Attributes.Add("href", printUrl);
            if (printUrl.IndexOf("javascript") == -1)
            {
                hplPrint.Attributes.Add("target", "_blank");
            }
        }

        if (string.IsNullOrEmpty(emailUrl))
        {
            // quick fix for lloyd to do video guides
            // string fileupload = "../client/pdf/test_test.pdf";
            phEmail.Visible = true;
         //   hplEmail.Attributes.Add("href", "mailto:"+ emailUrl+ "?subject=Planning Your Time Positively &body=Well done for all the effort you have put into using the strategy of planning your time positively &attachement="+ fileupload+"");
            hplEmail.Attributes.Add("attachment", "../client/pdf/test_test.pdf");
        }
        else
        {
            string fileupload = "../client/pdf/test_test.pdf";
            phEmail.Visible = true;
           // hplEmail.Attributes.Add("href",emailUrl);
            hplEmail.Attributes.Add("href", "mailto:" + emailUrl + "?subject=Planning Your Time Positively &body=Well done for all the effort you have put into using the strategy of planning your time positively. &attachment=" + fileupload + "");

        }

        if (string.IsNullOrEmpty(audioUrl))
        {
            phAudio.Visible = false;
        }
        else
        {
            phAudio.Visible = true;
            hplAudio.Attributes.Add("href", audioUrl);
        }
    }

    protected void imgBtnLogOut_Click(object sender, ImageClickEventArgs e)
    {
        Helpers.Logout();
    }
}

//ASPX page. I want to trigger this method when the email button is clicked, this method generated pdf

    protected void CreateSummaryPDF(object sender, EventArgs e)
    {
        // create all node chart images
          //==========Difficult Situation Chart============//

        WriteDifficultSituations(true);
        IDataReader dr1 = null;
         dr1 = LBM.ChartGetSlider(userID, LBM.Slider.DifficultSituations);
         Points obj1 = SortToYArray(dr1);
        ChartDifficultSituations.SaveImage(Server.MapPath("../images/charts/") + SessionID.ToString() + "_" + LBM.Node.DifficultSituations.ToString() + ".png", ChartImageFormat.Png);
        double a = obj1.maxVal;
        dr1.Dispose();
        //======================End========================//


        double[] check = { a };
        // set up pdf
        IPdfManager objPdf = new PdfManager();

        // Create empty document
        IPdfDocument objDoc = objPdf.OpenDocument(Server.MapPath("../client/pdf/Progress-summary.pdf"), Missing.Value);
        IPdfPage objPage = objDoc.Pages[1];
        IPdfFont objFont = objDoc.Fonts["Helvetica-Bold", Missing.Value];

        int[] arrX = { 80, 306, 80, 306, 80, 306, 80, 306 };
        int[] arrY = { 590, 590, 290, 290, 590, 590, 290, 290 };

        int i = 0;

        // loop nodes and place on PDF
        foreach (string name in Enum.GetNames(typeof(LBM.Node)))
        {

            // move onto the next page
            if (i > 3) {
                objPage = objDoc.Pages[2];
            }

            // add images
            IPdfImage objImage = objDoc.OpenImage(Server.MapPath("../images/charts/") + SessionID.ToString() + "_" + name + ".png", Missing.Value);

            // Add empty page. Page size is based on resolution and size of image
            float fWidth = objImage.Width * 72.0f / objImage.ResolutionX;
            float fHeight = objImage.Height * 72.0f / objImage.ResolutionY;

            // Create empty param object
            IPdfParam objParam = objPdf.CreateParam(Missing.Value);

            objParam["x"].Value = arrX[i];
            objParam["y"].Value = arrY[i] - fHeight;

            objPage.Canvas.DrawImage(objImage, objParam);

            objPage.Canvas.DrawText(name, "x=" + arrX[i] + ", y=" + (arrY[i]+50) + "; width=208; height=200; size=11; alignment=center; color=#ffffff", objFont);

            i++;

        } 
        String strFileName = objDoc.Save(Server.MapPath("../client/pdf/filledform.pdf"), true);
    }
}

Also I have got another method on a different ASPX page. I want to trigger that method when the client is on that page. The user control should trigger the right method depending on the page user is currently on.

  • 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-05-20T08:42:28+00:00Added an answer on May 20, 2026 at 8:42 am

    If I understand well, you’ve got 3 aspx pages and only one usercontrol containing a form.
    When you click on the usercontrol’s button, you want to launch a method on the page containing the usercontrol.

    In your usercontrol, you can add a new property (a delegate : Action<>), like this :

    // In your user control

    public Action<object, EventArgs> MyEvent;
    protected void Page_Load(object sender, EventArgs e)
    {
        // The button in the usercontrol
        btnTriggerEvent.Click += new EventHandler(btnTriggerEvent_Click);
    }
    // The click event for your button
    void btnTriggerEvent_Click(object sender, EventArgs e)
    {
        // Raise the event (Action<>) when the button is clicked
        MyEvent(sender, e);
    }
    

    // Specific method in the aspx page : (a simple one for the example)

    protected void Page_Load(object sender, EventArgs e)
    {
        // Trigger is the name of the usercontrol
        Trigger.MyEvent = TriggerDefault;
    }
    public void TriggerDefault(object sender, EventArgs e)
    {
        // Do whatever you want here
        Response.Write("ABOUT PAGE !!!"); // or some other text
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have around 40 aspx pages in my website. I want to use a
I have two pages, test1.aspx and test2.aspx test1.aspx has this protected void Page_Load(object sender,
I have two pages that inherit from one master page, First.aspx or second.aspx. Navigation
I have a content page(Say.. invoice.aspx) in asp.net application with master pages. The content
i have 2 textbox controls inside a usercontrol TextBoxUC.ascx i have a page.aspx that
I have a set of aspx pages which are made of up usercontrols. Each
I have an aspx page with a usercontrol say UC1. UC1 is using another
I have many aspx pages which inherits a base Class. base class has a
I have a usercontrol(.ascx) page that is used by about 10 pages to display
I have an aspx Page that contain a userControl that contains textboxes. in the

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.