开发者

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();
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜