DetailsView EditItemTemplate DropdownList Update Problem



Hi!

I have a DetailsView with a DropDownList in an EditItemTemplate, I know,
pretty cool right? But when I try to Update the table with a new value from
the DropDownList the table does not get updated with the new value. I'm new
at this and I'm sure I'm overlooking something simple here. I'll post the
ASP code, hopefully someone can help me with this one.

Thank you!


<%@ Page Language="C#" masterpagefile="~/software.master"
AutoEventWireup="true" CodeFile="MasterDetail.aspx.cs" Debug="true"
Inherits="MasterDetail" %>

<asp:Content ID="SoftwareData" runat="server"
ContentPlaceHolderID="PageBody">



<table><tr>

<td valign="top" style="width: 280px">

<asp:GridView ID="SummaryGrid" runat="server"
DataSourceID="AppsDBDataSource"

EnableViewState="False"

DataKeyNames="ci_id" AllowPaging="True"

AutoGenerateSelectButton="True"

AutoGenerateColumns="False" style="left: 73px; position: relative; top: 9px"
BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px"
CellPadding="3" Font-Names="Arial" Font-Size="X-Small" GridLines="Vertical"
Width="492px" PageSize="5">

<Columns>

<asp:BoundField DataField="manufacturer" HeaderText="Manufacturer" />

<asp:BoundField DataField="title" HeaderText="Title" />

<asp:BoundField DataField="version" HeaderText="Version" />

</Columns>

<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />

<RowStyle BackColor="#EEEEEE" ForeColor="Black" />

<SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />

<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center"
/>

<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />

<AlternatingRowStyle BackColor="Gainsboro" />

</asp:GridView>

</td>

<td valign="top">

<asp:DetailsView ID="DetailsView1" runat="server"

DataKeyNames="ci_id, media_type_id"

HeaderText="Software Package Details"

EmptyDataText="No package currently selected"

DataSourceID="RowDataSource"

AutoGenerateInsertButton="True"

AutoGenerateDeleteButton="True"

AutoGenerateEditButton="True" OnItemUpdated="DetailsView1_ItemUpdated"
style="left: 73px; position: relative; top: 9px" BackColor="White"
BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3"
Font-Names="Arial" Font-Size="X-Small" GridLines="Vertical" Width="320px"
AutoGenerateRows="False">

<Fields>

<asp:BoundField DataField="ci_id" HeaderText="ID" ReadOnly="True" />

<asp:CheckBoxField DataField="active" HeaderText="Active"
SortExpression="active" />

<asp:BoundField DataField="title" HeaderText="Title" >

<ControlStyle Width="225px" />

</asp:BoundField>

<asp:BoundField DataField="version" HeaderText="Version" />

<asp:BoundField DataField="other_version_info" HeaderText="Version Info" />

<asp:BoundField DataField="manufacturer" HeaderText="Manufacturer" />

<asp:TemplateField HeaderText="Media">

<EditItemTemplate>

&nbsp;

<asp:DropDownList ID="DropDownList1" runat="server"
DataSourceID="SQLMediaTypes"

DataTextField="media_type" DataValueField="media_type_id" Style="left: -6px;

position: relative; top: 0px" Width="161px" SelectedValue='<%#
Bind("media_type_id") %>'>

</asp:DropDownList>

</EditItemTemplate>

<InsertItemTemplate>

<asp:DropDownList ID="DropDownList2" runat="server"
DataSourceID="SQLMediaTypes"

DataTextField="media_type" DataValueField="media_type_id" Style="left: 0px;

position: relative; top: 0px" Width="161px" SelectedValue='<%#
Bind("media_type_id") %>'>

</asp:DropDownList>

</InsertItemTemplate>

<ItemTemplate>

<asp:Label ID="Label1" runat="server" Text='<%# Bind("media_type")
%>'></asp:Label>

</ItemTemplate>

</asp:TemplateField>

<asp:BoundField DataField="license_info" HeaderText="License Info" />

<asp:BoundField DataField="date_purchased" HeaderText="Purchase Date"
SortExpression="date_purchased" />


</Fields>

<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />

<EditRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White"
Font-Names="Arial" Font-Size="X-Small" />

<RowStyle BackColor="#EEEEEE" ForeColor="Black" />

<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center"
/>

<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />

<AlternatingRowStyle BackColor="Gainsboro" />

</asp:DetailsView>

</td>

</tr></table>

<asp:Label ID="Label2" runat="server" Font-Names="Courier New" Height="28px"
Style="z-index: 103;

left: 28px; position: absolute; top: -298px" Width="379px">Application
Management Database</asp:Label>

<asp:SqlDataSource ID="AppsDBDataSource" runat="server"

EnableCaching="false" CacheKeyDependency="AppsDBDataSource_Controller"

ConnectionString='<%$ ConnectionStrings:LocalAppsDB %>'

SelectCommand="SELECT * FROM vwSoftware">

</asp:SqlDataSource>

<asp:SqlDataSource ID="RowDataSource" runat="server"

EnableCaching="false"

ConnectionString='<%$ ConnectionStrings:LocalAppsDB %>'

SelectCommand="SELECT * FROM vwSoftware WHERE ci_id=@ci_id"

UpdateCommand="UPDATE software SET active=@active, title=@title,
version=@version, other_version_info=@other_version_info,
manufacturer=@manufacturer, media_type_id=@media_type_id,
license_info=@license_info, date_purchased=@date_purchased WHERE
ci_id=@ci_id"

InsertCommand="INSERT INTO software(active, title, version,
other_version_info, manufacturer, media_type_id, license_info,
date_purchased) VALUES(@active, @title, @version, @other_version_info,
@manufacturer, @media_type_id, @license_info, @date_purchased)"

DeleteCommand="DELETE FROM software WHERE ci_id=@ci_id">

<SelectParameters>

<asp:ControlParameter Name="ci_id" ControlID="SummaryGrid"
PropertyName="SelectedValue" />

</SelectParameters>

</asp:SqlDataSource>

<asp:SqlDataSource ID="SQLMediaTypes" runat="server" ConnectionString="<%$
ConnectionStrings:LocalAppsDB %>"

OnSelecting="SQLMediaTypes_Selecting" ProviderName="<%$
ConnectionStrings:LocalAppsDB.ProviderName %>"

SelectCommand="SELECT [media_type_id], [media_type] FROM
[media_type]"></asp:SqlDataSource>


</asp:Content>


.