title: Passing Class as an argument to an image click event Handler
body: <p>I have a Trip object which I am getting from list TripsByTripIds which I want to pass as a parameter to image click event handler down below. how do I pass it?</p>
  
  <pre><code>  foreach (Tripclass Trip in TripsByTripIds )
    {
        ImageButton imageButton = new ImageButton();
        imageButton.ImageUrl = "~/" +Trip.CorridorName+"/"+Trip.Time+"/"+Trip.ImgFileName;
        imageButton.Height = Unit.Pixel(100);
        imageButton.Style.Add("padding", "5px");
        imageButton.Width = Unit.Pixel(100);
        imageButton.Click += new ImageClickEventHandler(imageButton_Click);
        AMSPanel1.Controls.Add(imageButton);
        AMSPanel1.Height = Unit.Pixel(860);
    }
  
    protected void imageButton_Click(object sender, ImageClickEventArgs fi)
    {
        testimage.ImageUrl = ((ImageButton)sender).ImageUrl;
        lblTime.Text = Trip.Time; 
        lblLocation.Text = Trip.Location; //can't access trip object here
    }    
  </code></pre>