1
我試圖綁定一個asp:DropDownList
但我一直收到錯誤ASP.NET綁定的DropDownList拋出錯誤
類型「System.Web.HttpException」的異常出現在 System.Web.dll中,但在用戶代碼中沒有處理
其他信息:數據綁定:「System.Data.DataRowView」並不 不包含與「id_enabled」的名稱的屬性
這裏是我的SqlDataSource
<asp:SqlDataSource
ID="sql_enabled_ddl"
runat="server"
ConnectionString="<%$ ConnectionStrings:Tip-Tour %>"
SelectCommand ="SELECT
id_enabled,
description
FROM
(
SELECT
1 AS id_enabled,
'true' AS description
UNION
SELECT
2 AS id_enabled,
'false' AS description
) AS passport_enabled">
</asp:SqlDataSource>
和我的DropDownList
<asp:DropDownList
ID="DropDownList2"
runat="server"
DataSourceID="sql_enabled_ddl"
DataTextField="description"
DataValueField="id_enabled"
SelectedValue='<%# Bind("id_enabled") %>'
Width="87%">
</asp:DropDownList>
tthat引發不同的錯誤....異常詳細信息:System.Data.SqlClient.SqlException:無效的列名稱'id_enabled'。 – blitzeus
你能在測試新的aspx頁面上面的代碼中沒有母版頁? – Win
這是一個FormView EditItemTemplate中 – blitzeus