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 8342233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:42:34+00:00 2026-06-09T05:42:34+00:00

I have created a html5 canvas and javascript signature pad that I would like

  • 0

I have created a html5 canvas and javascript signature pad that I would like to implement as a web user control with an update panel to handle the button clicks. For some reason if I add the update panel and signature pad controls directly into the aspx file the auto postback events work but when I place the same code into a web user control the fields (canvas, buttons, divs, etc) appear but the auto postback no longer works. In both cases I am placing my script manager above the update panel.

Here’s my ascx code:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Signature_Pad.ascx.cs"     Inherits="Controls_Signature_Pad" %>

 <asp:UpdatePanel runat="server" ID="signatureUpdate"  updatemode="Conditional">
  <Triggers>
     <asp:AsyncPostBackTrigger controlid="signatureApprove" eventname="Click" />
     <asp:AsyncPostBackTrigger controlid="sigClear" eventname="Click" />
     <asp:AsyncPostBackTrigger controlid="sigCancel" eventname="Click" />
  </Triggers>
  <ContentTemplate>
        <fieldset id="SignatureFieldSet" runat="server" style=" border: 1 solid black;">
       <p><asp:Label ID="signatureTextLabel" AutoPostBack="true"  runat="server" Text=""></asp:Label></p>
        <div id="canvasDiv" style="height: 300px; border:0px solid #000000; ">
            <canvas id="canvasSignature"  style="border:1px solid #000000;"></canvas>
        </div>
        <div id="sigButtonDiv"  style=" border:0px solid #000000;">
            <br /><br />
            <asp:Button AutoPostBack="true" runat="server" OnClick="OnApprove" ID="signatureApprove" Text="Approve" />
            <asp:Button AutoPostBack="true" runat="server" OnClick="OnClear" ID="sigClear" Text="Clear" />
            <asp:Button AutoPostBack="true" runat="server" OnClick="OnCancel" ID="sigCancel" Text="Cancel" />
        </div> 
    </fieldset>
 </ContentTemplate>
</asp:UpdatePanel>

Here’s my ascx code behind:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Controls_Signature_Pad : System.Web.UI.UserControl
{
private string signatureData;
private string signatureText;

public string SignatureData
{
    get { return signatureData; }
    set { signatureData = value; }
}
public string SignatureText
{
    get { return signatureText; }
    set { signatureText = value; }
}

public void OnApprove(object sender, EventArgs e)
{
    UtilityClass.showMessageBox("Approve Clicked", this);
    SignatureText = "Approved Clicked";
}
public void OnClear(object sender, EventArgs e)
{
    UtilityClass.showMessageBox("Clear Clicked", this);
    SignatureText = "Clear Clicked";
}
public void OnCancel(object sender, EventArgs e)
{
    UtilityClass.showMessageBox("Cancel Clicked", this);
    SignatureText = "Cancel Clicked";
}

public void Page_Load(object sender, EventArgs e)
{
    signatureTextLabel.Text = signatureText;
}
}

Here’s my relevant aspx:

...
<%@ Register TagPrefix="mjt" TagName="SignaturePad" Src="~/Controls/Signature_Pad.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

<asp:ScriptManager ID="ScriptManager" runat="server" EnablePartialRendering="true" EnablePageMethods="true"></asp:ScriptManager>
 <mjt:SignaturePad ID="SignaturePad" runat="server" Visible="true" SignatureData="" SignatureText="Test Signature Test." />

...
  • 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-06-09T05:42:35+00:00Added an answer on June 9, 2026 at 5:42 am

    Adding event handlers in the code behind fixed the problem. Here’s my code:

    The control had three buttons that needed to trigger events (Approve, Clear, and Canceled).

    In ascx.cs:

    public event EventHandler Approved;
    public event EventHandler Cleared;
    public event EventHandler Canceled;
    
     protected void signatureApprove_clicked(object sender, EventArgs e)
    {
    
        if(Approved != null)
        Approved(this, EventArgs.Empty);
    
    }
    protected void sigClear_clicked(object sender, EventArgs e)
    {
            if (Cleared != null)
            Cleared(this, EventArgs.Empty);
    }
    protected void sigCancel_clicked(object sender, EventArgs e)
    {
           if (Canceled != null)
           Canceled(this, EventArgs.Empty);
    }
    

    In ascx:

     <asp:UpdatePanel runat="server" ID="signatureUpdate"  updatemode="Conditional">
      <Triggers>
         <asp:AsyncPostBackTrigger controlid="signatureApprove" eventname="Click" />
         <asp:AsyncPostBackTrigger controlid="sigClear" eventname="Click" />
         <asp:AsyncPostBackTrigger controlid="sigCancel" eventname="Click" />
      </Triggers>
         <ContentTemplate>
           <fieldset id="SignatureFieldSet" class="fieldSetStyle" >
            <p><asp:Label ID="signatureTextLabel" AutoPostBack="true"  runat="server" Text=""></asp:Label></p>
            <div id="canvasDiv" runat="server" >
                <canvas id="canvasSignature" class="canvasStyle"></canvas> 
            </div>
            <div id="sigButtonDiv">
            <br />
                <asp:Button  AutoPostBack="true" runat="server" OnClick="signatureApprove_clicked" ID="signatureApprove" Text="Approve" CssClass="buttonStyle" />
                <asp:Button  AutoPostBack="true" runat="server" OnClick="sigClear_clicked" ID="sigClear" Text="Clear" CssClass="buttonStyle"/>
                <asp:Button  AutoPostBack="true" runat="server" OnClick="sigCancel_clicked" ID="sigCancel" Text="Cancel" CssClass="buttonStyle"/>
            </div> 
          </fieldset>
        </ContentTemplate>
    </asp:UpdatePanel>
    

    In aspx:

    <mjt:SignaturePad OnApproved="Signature_Approved"   OnCanceled="Signature_Canceled" OnCleared="Signature_Cleared" ID="SignaturePad" runat="server"   />
    

    In aspx.cs:

    protected void Signature_Approved(object sender, EventArgs e)
    {
        //Do signature approved action
    }
    protected void Signature_Canceled(object sender, EventArgs e)
    {
        //Do signature cancel action
    }
    protected void Signature_Cleared(object sender, EventArgs e)
    {
       //Do signature cleared action
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

OK, so I have created an HTML5 canvas game that uses localStorage. I have
I have recently created a HTML5 canvas animation (also using Processing.js). The problem is
I have created a simple layout using the HTML div tag. I would like
I'd like to have an HTML canvas context that I can paint to and
I have created an image in my Canvas with HTML5 and I saved it.
I'm developing a painter program using HTML5 canvas. I have created a drawing tool
I've got here some javascript code, that implements a signature pad. It works fine
I'm trying to create an animation using HTML5 canvas and Javascript. I have very
I have created image using svg and javascript I want user to be able
I have created a basic shape in HTML canvas element which works fine. 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.