Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
465
Client Side Event not firing
posted

Hopefully I'm overlooking something simple.  Below are sections of my code.  The problem is that the click event does not seem to be firing.  I am defining the click event in the aspx.cs code, and including a javascript function in my .aspx client code.  What might I be missing?  Thanks for the continuing support!

From my .aspx file:

 <head runat="server">

    <title></title>

   <script id="igClientScript" type="text/javascript">

<!--

 

function UltraGauge1_Click(){

    alert("gauge clicked");

}

// -->

</script>

 

 

</head>

From my .aspx.cs file:

 

            ultraGauge1.Gauges.Add(myLinearGauge);

            //ultraGauge1.Gauges.Add(myLinearGauge2);

            ultraGauge1.ClientSideEvents.Click = "UltraGauge1_Click";

            ultraGauge1.DeploymentScenario.Mode = ImageDeploymentMode.Session;

           //ultraGauge1.DeploymentScenario.FilePath = "GaugeImages";

            ultraGauge1.ID = zone;

            ultraGauge1.Height = Unit.Pixel(50);

            ultraGauge1.Width = Unit.Pixel(400);

            ultraGauge1.TabIndex = 0;

 

            this.Controls.Add(ultraGauge1);

 

  • 28496
    Offline posted

    replace

            this.Controls.Add(ultraGauge1);

    with

            this.FindControl("form1").Controls.Add(ultraGauge1);

    ...if you look at the rendered html of the page, you will see why this is necessary.  calling this.Controls.Add on a Page results in markup added after the </html> tag, which can cause all sorts of problems.