【发布时间】:2009-01-23 17:05:23
【问题描述】:
我有一个带有 DropDownList(在项目模板中)和一个 ButtonField 的 ASP.NET GridView。
<my:GridView AutoGenerateColumns="false" ID="CurrentCardGrid" UseHighlights="False" runat="server" Width="100%">
<Columns>
<asp:BoundField HeaderText="ID" ItemStyle-Width="50px" DataField="Id" />
<asp:TemplateField HeaderText="" ItemStyle-Width="150px">
<ItemTemplate>
<asp:DropDownList runat="server" ID="StatusList" Width="140px">
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:ButtonField Text="Update" ButtonType="Button" CommandName="Update" />
</Columns>
</my:GridView>
在代码中,我填充下拉列表并捕获 RowCommand 事件。
我的问题是,在 RowCommand 事件处理程序中,我如何获取当前行?我需要从下拉列表中获取值并将行的状态(由 ID 指向)设置为下拉列表中的值。请注意,该行不会处于更新模式。
提前致谢!
汤姆
【问题讨论】: