Click event on Custom control not firing

Posted by Community Admin on 04-Aug-2018 04:34

Click event on Custom control not firing

All Replies

Posted by Community Admin on 06-Aug-2014 00:00


Just realized that this may have been more appropriate for the Developing with Sitefinity forum so please move if that forum is more appropriate. 

I have created a custom control using Sitefinity Thunder. We are using custom controls rather than user controls because we are getting a published Sitefinity website.

It has created the .ascx, .cs and designer files as expected.  I have added an ASP Button server control to the .ascx and referenced it in the .cs in the same manner as the Message Label example (except its a button).

In InitializeControls I add the click event handler (see attached).

The problem that I am having is that the click event does not fire.  I have looked at the examples on the Sitefinity website but they seem to successfully avoid this topic. 

Any comments appreciated?

Thanks Peter

  protected override void InitializeControls(GenericContainer container)

Label messageLabel = this.MessageLabel;
if (string.IsNullOrEmpty(this.Message))

messageLabel.Text = "Hello, World!";


messageLabel.Text = this.Message;

this.nextBtn = NextButton;

this.nextBtn.Click += new EventHandler(nextBtn_Click);

void nextBtn_Click(object sender, EventArgs e)

throw new NotImplementedException();


Posted by Community Admin on 08-Aug-2014 00:00

Hi Peter,

Can you try by enabling the ViewState of the page where the control is located? (going to the page's Actions->Title & Properties -> Advanced Options -> Enable ViewState)

Best Regards,
Junior Dominguez

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items

This thread is closed