开发者

User event SelectedIndexChanged does not take DataBinding new row

开发者 https://www.devze.com 2023-03-18 20:45 出处:网络
I have a DDL linked with a binding source. Lets say in the binding source I have 3 rows; 1 - One 2开发者_开发百科 - Two

I have a DDL linked with a binding source. Lets say in the binding source I have 3 rows;

1 - One 2开发者_开发百科 - Two 3 - Three

When I select the first row, within the method SelectedIndexChanged thw Current BindingSource row is null. Then if I select the second row the current row is the previous one, the first until the SelectedIndexChanged is returned.

Is there a way to get the current row while in SelectedIndexChanged?


Try this:

DataTable dt = (DataTable)ddl.DataSource;

string result = dt.Rows[ddl.SelectedIndex]["col_name"].ToString();
0

精彩评论

暂无评论...
验证码 换一张
取 消