【发布时间】:2018-11-07 19:25:34
【问题描述】:
我有dropdownlist,其中包含一些项目,我通过从SQLServer 数据库中提取数据来插入这些项目。所以我想根据当前选择的项目来编辑项目。我的想法是通过单击按钮获取所选特定项目的 ID,我该如何在 WebForms 中做到这一点?
.ASPX 代码
<asp:DropDownList ID="ddlEvento" name="1" class="form-control" runat="server" ></asp:DropDownList>
<asp:Button runat="server" ID="btnEdit_EventType" CssClass="editButton"/>
提前致谢
【问题讨论】:
-
ddlEvento.SelectedItem.Value 将为您提供与所选项目关联的值。
-
想要在脚本或后端代码中使用它吗?
标签: c# asp.net webforms dropdown