Handle Button Click in WinForm DataRepeater C# Power Pack

…衆ロ難τιáo~ 提交于 2020-01-15 03:09:09

问题


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:


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);
    }


来源:https://stackoverflow.com/questions/1483323/handle-button-click-in-winform-datarepeater-c-sharp-power-pack

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!