Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何gridview从不是 gridview 事件的事件中获取编辑模式下的行索引?
gridview
我在 Gridview 的单元格中有一个 DDL。当 DDL 更改时,我想对同一行中另一个单元格的标签执行更新。
所以我正在使用DDL_SelectedIndexChanged事件并且一切正常,包括标签的帖子,但它始终是第一行。从事件外部以编辑模式获取行索引的正确方法是什么gridview?
DDL_SelectedIndexChanged
谢谢,
试试这个
protected void DDL_SelectedIndexChanged(Object sender, EventArgs e) { DropDownList ddlcontrol = (DropDownList) sender; GridViewRow grrow = (GridViewRow) ddlcontrol.NamingContainer; int rowindex = grrow.RowIndex; }