DataBindingComplete is getting called multiple times

前端 未结 2 979
南方客
南方客 2020-12-21 00:39

I am creating a windows application in c#,

I have 1 Datagridview and after I set it\'s DataSource it should have 3 Rows.

I have attached 2 Event Habdlers to

2条回答
  •  孤城傲影
    2020-12-21 01:10

    I believe it depends on your other methods, where you're actually setting the DataSource. It seems to me like you're either setting the DataSource twice or calling DataBind twice, and on each DataBind you're actually getting two rows into the DataGridView, thus the 4 total.

    Some additional code might help...

    Some things to try: search for DataBind(), DataSource(), etc in your code and make sure it's only being called in the appropriate places.

    Additionally, it's not necessarily bad for the DataBind to be called twice, assuming something changes between the databinds... some change of state... really hard to say without background.

提交回复
热议问题