User event SelectedIndexChanged does not take DataBinding new row
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();
精彩评论