【发布时间】:2012-11-29 15:18:41
【问题描述】:
DropDownList11 出现错误,提示“'DropDownList11' 的 SelectedValue 无效,因为它不存在于项目列表中。 参数名称:值”。其他带有 SQLDatasource 的下拉列表工作正常。我在编辑 DetailsView 中手动创建此下拉列表。一旦选择并单击更新,它将发送到 SQL Server。请帮助!这里是代码,
<EditItemTemplate>
<asp:DropDownList ID="DropDownList11" runat="server" SelectedValue='<%# Bind("Version") %>'>
<asp:ListItem Selected="True"></asp:ListItem>
<asp:ListItem>Oracle 11g</asp:ListItem>
<asp:ListItem>Oracle 11g R2</asp:ListItem>
<asp:ListItem>Server 2008</asp:ListItem>
<asp:ListItem>Server 2008 R2</asp:ListItem>
<asp:ListItem>Server 2012</asp:ListItem>
<asp:ListItem>SQL Svr 2008 R2 SS%S</asp:ListItem>
<asp:ListItem>SQL Svr 2012 SS%S</asp:ListItem>
</asp:DropDownList>
</EditItemTemplate>
【问题讨论】:
-
什么是Version,你怎么看?
-
这是在
中。 Version 是数据库表中的列名。 -
问题是DropDownList没有DataSource,Bind不知道Version在哪里
-
好的,如何在不使用 DataSource 的情况下解决这个问题?
标签: asp.net