DropDownList not submitting to db

Oct 2, 2007
Reaction score
I think I'm missing something really obvious but can't for the life of me figure out what. I've got a details view submitting to a db but for some reason the dropdown list field isn't going through the update even though (I think) I've specified that it should and it is throwing the error that it can't submit because the column can't be null. Here is the code of what I've done. Am I missing something really obvious???

<form id="form1" runat="server">
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:publicationsListConnectionString %>"
SelectCommand="SELECT Status.Status, PublicationRecords.NameOrTitle, PublicationRecords.LocationOfDocument, PublicationRecords.Description, PublicationRecords.ISBN_ISSN_DOI FROM Status INNER JOIN PublicationRecords ON Status.StatusID = PublicationRecords.StatusID WHERE (PublicationRecords.ID = @ID)"
UpdateCommand="UPDATE PublicationRecords SET StatusID = @StatusID, NameOrTitle = @NameOrTitle, LocationOfDocument = @LocationOfDocument, Description = @Description, ISBN_ISSN_DOI = @ISNB_ISSN_DOI">
<asp:QueryStringParameter Name="ID" QueryStringField="ID" />
<asp:parameter Name="StatusID" Type="Int32" />
<asp:parameter Name="NameOrTitle" Type="String" />
<asp:parameter Name="LocationOfDocument" Type="String" />
<asp:parameter Name="Description" Type="String" />
<asp:parameter Name="ISNB_ISSN_DOI" />
&nbsp;&nbsp;<asp:SqlDataSource ID="StatusSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:publicationsListConnectionString %>"
SelectCommand="SELECT * FROM [Status]">

<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataSourceID="SqlDataSource1"
Height="50px" Width="125px">
<asp:Label ID="StatusLabel" runat="server" Text='<%# Bind("Status") %>'></asp:Label>
<asp:DropDownList ID="StatusID" runat="server" DataSourceID="StatusSqlDataSource"
DataTextField="Status" DataValueField="StatusID" AutoPostBack="True">
<asp:BoundField DataField="NameOrTitle" HeaderText="NameOrTitle" SortExpression="NameOrTitle" />
<asp:BoundField DataField="LocationOfDocument" HeaderText="LocationOfDocument" SortExpression="LocationOfDocument" />
<asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
<asp:BoundField DataField="ISBN_ISSN_DOI" HeaderText="ISBN_ISSN_DOI" SortExpression="ISBN_ISSN_DOI" />
<asp:CommandField ShowEditButton="True" />


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads