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. Image for the cookie policy date

ej:Button onclick not working with C# code behind file

I'm working with Visual Studio 2015 with a Web Forms Project without a Masterfile page.
I want to have as much code as possible in a C# Code Behind file.
I tried to integrate an ej:Button in my Project, but it won't call the onclick method.
Then i tried the same with an asp:Button and it simply works.
Here is some of my code:
//aspx file:
<ej:Button runat="server" OnClick="onSaveClick"></ej:Button>

//aspx.cs file (the code behind file):
    protected void onSaveClick(object sender, EventArgs e)
    {
        Debug.WriteLine("Saved");
    }

Generally speaking, i have a hard time following the documentation,the samples and the API.
I searched for ej:Button and other things in all of them and most examples are without a proper C#
way of doing it. Often there is only a javascript way of doing so.

Am I missing some documentation or is this simply the wrong way im trying to program?

Thanks in advance,
Fabian Lorenz

3 Replies

TM Thirukumaran Murugan Syncfusion Team January 17, 2017 04:35 PM UTC

Hi Fabian Lorenz, 
  
Thanks for contacting syncfusion support,  
  
We suspect that server side events might not be triggered due to (ej.webforms.min.js) script file reference missing in the application, so please include the ej.webforms.min.js script file in the page   
For more information visit the below link.  
  
Regards,  
Thirukumaran M.  



FL Fabian Lorenz January 17, 2017 08:52 PM UTC

Thanks for the reply but in the meantime I solved the problem by myself.
I am using the Syncfusion Project Template to generate a project, so
the required files where already there.
My fault was that i forgot to include:

<asp:ScriptManager runat="server"></asp:ScriptManager>

I wouldn't had the problem if I would have used a masterfile in my project.
The template includes the Scriptmanager there by default.
So I guess in the future I will use the Masterfile more often. :)





FP Francis Paul Antony Raj Syncfusion Team January 19, 2017 03:53 AM UTC

Hi Fabian, 
 
We are glad to know that your issue has been resolved. 
 
Please let us know if you need further assistance. 
 
Regards, 
Francis Paul A. 


Loader.
Up arrow icon