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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Why is ClientSideOnClick not firing?

Thread ID:

Created:

Updated:

Platform:

Replies:

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

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 11:11 AM UTC

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 08:26 AM UTC

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 07:12 AM UTC

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.

Warning Icon 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.Close Icon

;