We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Why is ClientSideOnClick not firing?

Thread ID:

Created:

Updated:

Platform:

Replies:

129741 Mar 31,2017 08:43 AM Apr 6,2017 03:12 AM ASP.NET Web Forms 3
loading
Tags: Button
Carsten Wuttke
Asked On March 31, 2017 08:43 AM

Hi,

i create a button in code-behind like this:
 Syncfusion.JavaScript.Web.Button b = new Syncfusion.JavaScript.Web.Button();
        b.Text = "Eigene Datei hochladen";
        b.ID = dialog.ID + "bup";
        b.ClientSideOnClick = "alert('Hi');";
        b.ClientIDMode = ClientIDMode.Static;
        b.Type = Syncfusion.JavaScript.ButtonType.Button;
        dialog.DialogContent.Controls.Add(b);

But the ClientSideOnClick (the alert-dialog) never appears.

Yes. I included ej.webforms.min.js

Francis Paul Antony Raj [Syncfusion]
Replied On April 3, 2017 07:11 AM

Hi Carsten, 
 
Thanks for contacting Syncfusion Support. 
 
To utilize the EJ control events, please specify the event handler name (function name) and define this function at client side script section of the sample as mentioned below. 
 
[aspx.cs – code-behind] 
            Syncfusion.JavaScript.Web.Button b = new Syncfusion.JavaScript.Web.Button(); 
            b.Text = "Eigene Datei hochladen"; 
            b.ID = dialog.ID + "bup"; 
            b.ClientSideOnClick = "clientSideClick"; //event handler 'clientSideClick' 
            b.ClientIDMode = ClientIDMode.Static; 
            b.Type = Syncfusion.JavaScript.ButtonType.Button; 
            dialog.DialogContent.Controls.Add(b); 
 
[.aspx] 
<ej:Dialog ID="dialog" runat="server"></ej:Dialog> 
 
[script] 
           function clientSideClick(e) { 
               alert("hi"); 
           } 
 
P:S: EJ Event handler can have function name only and it doesn’t process the string values (like “alert('Hi');”) 
 
Regards, 
Francis Paul A. 


Carsten Wuttke
Replied On April 5, 2017 04:26 AM

Thanks Francis. That worked. Even I then had the problem to give a button-specific data with without creating a script for every single button. But solved it with the WebControls.Button...

Francis Paul Antony Raj [Syncfusion]
Replied On April 6, 2017 03:12 AM

Hi Carsten, 
 
Most Welcome. Please let us know if you need further assistance. 
 
Regards, 
Francis Paul A. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;