Handle Button Click in WinForm DataRepeater C# Pow

2019-07-21 16:22发布

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

1条回答
够拽才男人
2楼-- · 2019-07-21 16:51

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);
    }
查看更多
登录 后发表回答