Tech Off Post

Single Post Permalink

View Thread: ASP.Net - UserControl events in a ListView
  • User profile image


    I have a page with a ListView that contains a custom UserControl. The usercontrol have events, but I cant figure out how to subscribe to these events.

    I tried to define in the aspx file without any luck. I've also tried to set in in the PreRender event of the usercontrol, but the event are always null in the usercontrol no matter what I do.

    This is what I got now;

    protected void animalCardControl1_OnPreRender(object sender, EventArgs e) {
    animalCardControl a = (animalCardControl)sender;

    a.DetailsClickedEvent += new animalCardControl.DetailsClickedHandler(animalCardControl1_DetailsClicked);
    a.Thumb = IsCheckBoxList;


    Any suggestions ??