2

i want to handle winform button click in the DataRepeater, how can i do it? all button are placed in a DataRepeater

Thank you very much

DucDigital
  • 4,580
  • 9
  • 49
  • 97

1 Answers1

5

In visual studio designer, double click the button then you get the empty eventhandler method. Add code there.

You can get the current item via CurrentItem or CurrentItemIndex to get which button was clicked...

    private void button1_Click(object sender, EventArgs e)
    {
        Console.WriteLine("DEBUG: CurrentItem: " + dataRepeater1.CurrentItem);
        Console.WriteLine("DEBUG: CurrentItemIndex: " + dataRepeater1.CurrentItemIndex);
    }
Peter Gfader
  • 7,673
  • 8
  • 55
  • 56
  • Thanks very much for this one. This is quite an old question that i've come up with a different solution that more common, but this help :) – DucDigital Jan 02 '10 at 18:52