So im having trouble binding a dropdownlist from a FormViewEditItemTemplate
I created a asp:SqlDataSource, set the UpdateCommand, supposedly bind the id_enabled value, though it doesn't work
When i push the Edit button it crashes and gives the following error
DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'id_enabled'
<%@ Page
Title=""
Language="C#"
MasterPageFile="~/AdminPanel.Master"
AutoEventWireup="true"
CodeBehind="PassportDetail.aspx.cs"
Inherits="TipTourAdminPanel.PassportDetail" %>
<asp:Content
ID="Content1"
ContentPlaceHolderID="head"
runat="server">
</asp:Content>
<asp:Content
ID="Content2"
ContentPlaceHolderID="ContentPlaceHolder1"
runat="server">
<asp:SqlDataSource
ID="SqlDataSource_rewardDetail" .
runat="server"
ConnectionString="<%$ ConnectionStrings:Tip-Tour %>"
SelectCommand= "SELECT
tt_passport.id_passport,
tt_passport.id_tour,
tt_passport.description AS passport_description,
tt_passport.id_passport_requirement,
tt_passport_requirement.description AS passport_requirements,
tt_tour.title AS tour_title,
tt_tour.body AS tour_description,
tt_passport.enabled
FROM tt_passport
JOIN tt_passport_requirement
ON tt_passport_requirement.id_passport_requirement = tt_passport.id_passport_requirement
JOIN tt_tour
ON tt_tour.id_tour = tt_passport.id_tour
WHERE tt_passport.id_passport = @id_passport"
UpdateCommand= "UPDATE tt_passport
SET
tt_passport.description = @passport_description,
tt_passport.id_passport_requirement = @id_passport_requirement,
tt_passport.enabled = @id_enabled
WHERE tt_passport.id_passport = @id_passport"
DeleteCommand= "Delete FROM tt_passport
WHERE tt_passport.id_passport = @id_passport">
<SelectParameters>
<asp:QueryStringParameter
DefaultValue="0"
Name="id_passport"
QueryStringField="id_passport" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="passport_description" />
<asp:Parameter Name="id_passport_requirement" />
<asp:Parameter Name="id_passport"/>
<asp:Parameter Name="id_enabled"/>
</UpdateParameters>
</asp:SqlDataSource>
<asp:SqlDataSource
ID="sql_enabled_ddl"
runat="server"
ConnectionString="<%$ ConnectionStrings:Tip-Tour %>"
SelectCommand =";With passport_enabled AS
(
Select 1 as id_enabled, 'true' AS description
UNION
Select 0 as id_enabled, 'false' AS description
)
SELECT id_enabled, description FROM passport_enabled">
</asp:SqlDataSource>
<asp:SqlDataSource
ID="SqlDataSource_rewardRequirements"
runat="server"
ConnectionString="<%$ ConnectionStrings:Tip-Tour %>"
SelectCommand= "SELECT
id_passport_requirement,
description
FROM tt_passport_requirement">
</asp:SqlDataSource>
<div class="textHeader">Passport:</div>
<asp:FormView
ID="FormView1"
runat="server"
DataSourceID="SqlDataSource_rewardDetail"
DataKeyNames="id_passport">
<EditItemTemplate>
<table id="tableForm">
<tr>
<th>id_passport:</th>
<td>
<asp:Label
Text='<%# Eval("id_passport") %>'
runat="server"
ID="id_passportLabel1" />
</td>
</tr>
<tr>
<th>passport_description:</th>
<td>
<asp:TextBox
Text='<%# Bind("passport_description") %>'
runat="server"
ID="passport_descriptionTextBox"
TextMode="MultiLine"
Rows="10"/>
</td>
</tr>
<tr>
<th>passport_requirements:</th>
<td>
<asp:DropDownList
ID="DropDownList1"
runat="server"
DataSourceID="SqlDataSource_rewardRequirements"
DataTextField="description"
DataValueField="id_passport_requirement"
SelectedValue='<%# Bind("id_passport_requirement") %>'
Width="87%">
</asp:DropDownList>
</td>
</tr>
<tr>
<th>enabled:</th>
<td>
<asp:DropDownList
ID="DropDownList2"
runat="server"
DataSourceID="sql_enabled_ddl"
DataTextField="description"
DataValueField="id_enabled"
SelectedValue='<%# Bind("enabled") %>'
Width="87%">
</asp:DropDownList>
</td>
</tr>
</table>
<br />
<asp:LinkButton
runat="server"
Text="Update"
CommandName="Update"
ID="UpdateButton"
CausesValidation="True" />
<asp:LinkButton
runat="server"
Text="Cancel"
CommandName="Cancel"
ID="UpdateCancelButton"
CausesValidation="False" />
</EditItemTemplate>
</asp:FormView>
</asp:Content>