+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / Click event on Custom control not firing

Click event on Custom control not firing

2 posts, 0 answered
  1. Peter
    Peter avatar
    1 posts
    Registered:
    06 Aug 2014
    06 Aug 2014
    Link to this post

    Hi

    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!";
    }
    else
    {
    messageLabel.Text = this.Message;
    }
    this.nextBtn = NextButton;

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

    void nextBtn_Click(object sender, EventArgs e)
    {
    throw new NotImplementedException();
    }

     

  2. Junior Dominguez
    Junior Dominguez avatar
    115 posts
    Registered:
    02 Dec 2016
    08 Aug 2014
    Link to this post
    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
    Telerik
     
    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
     
2 posts, 0 answered