473,408 Members | 2,477 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

DropDownList not submitting to db

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???

Expand|Select|Wrap|Line Numbers
  1. <form id="form1" runat="server">
  2.     <div>
  3.         <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:PublicationsListConnectionString %>"
  4.             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)"
  5.             UpdateCommand="UPDATE PublicationRecords SET StatusID = @StatusID, NameOrTitle = @NameOrTitle, LocationOfDocument = @LocationOfDocument, Description = @Description, ISBN_ISSN_DOI = @ISNB_ISSN_DOI">
  6.             <SelectParameters>
  7.                 <asp:QueryStringParameter Name="ID" QueryStringField="ID" />
  8.             </SelectParameters>
  9.             <UpdateParameters>
  10.                 <asp:Parameter Name="StatusID" Type="Int32" />
  11.                 <asp:Parameter Name="NameOrTitle" Type="String" />
  12.                 <asp:Parameter Name="LocationOfDocument" Type="String" />
  13.                 <asp:Parameter Name="Description" Type="String" />
  14.                 <asp:Parameter Name="ISNB_ISSN_DOI" />
  15.                 </UpdateParameters>
  16.         </asp:SqlDataSource>
  17.         &nbsp;&nbsp;<asp:SqlDataSource ID="StatusSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:PublicationsListConnectionString %>"
  18.             SelectCommand="SELECT * FROM [Status]">
  19.         </asp:SqlDataSource>
  20.  
  21.         <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataSourceID="SqlDataSource1"
  22.             Height="50px" Width="125px">
  23.             <Fields>
  24.                     <asp:TemplateField>  
  25.                     <ItemTemplate>
  26.                             <asp:Label ID="StatusLabel" runat="server" Text='<%# Bind("Status") %>'></asp:Label>
  27.                         </ItemTemplate>              
  28.                 <EditItemTemplate>
  29.                     <asp:DropDownList ID="StatusID" runat="server" DataSourceID="StatusSqlDataSource"
  30.                         DataTextField="Status" DataValueField="StatusID" AutoPostBack="True">
  31.                     </asp:DropDownList>
  32.                 </EditItemTemplate>
  33.                 </asp:TemplateField>
  34.                 <asp:BoundField DataField="NameOrTitle" HeaderText="NameOrTitle" SortExpression="NameOrTitle" />
  35.                 <asp:BoundField DataField="LocationOfDocument" HeaderText="LocationOfDocument" SortExpression="LocationOfDocument" />
  36.                 <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
  37.                 <asp:BoundField DataField="ISBN_ISSN_DOI" HeaderText="ISBN_ISSN_DOI" SortExpression="ISBN_ISSN_DOI" />
  38.                 <asp:CommandField ShowEditButton="True" />
  39.             </Fields>
  40.         </asp:DetailsView>
  41.     </div>
  42.     </form>
Oct 2 '07 #1
2 969
jhardman
3,406 Expert 2GB
Ruby,

Hello, and welcome to the scripts.com developer network. I have moved your thread to the .NET forum, there is a technical difference between ASP and ASP.NET and your question deals with the latter, so it belongs in the .NET forum.

BTW, thanks for posting your question clearly and in detail and putting your code in code tags. We really appreciate that extra effort.

Jared, moderator
ASP forum
Oct 4 '07 #2
Shashi Sadasivan
1,435 Expert 1GB
Just checking.!
Are you retriving the StatusID into your dataset which is being used to populate your dropdown?

cheers
Oct 4 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Stanley J Mroczek | last post by:
How do you load a dropdownlist when edit is clicked in a datagrid ? <Columns> <asp:BoundColumn DataField="OptionDescription" ItemStyle-Wrap="True" HeaderText="Option...
2
by: Dominic | last post by:
Hi guys, I'm not sure if this question belongs to FAQ, but I couldn't find a concrete answer. I created a Datagrid control using ItemTemplate, but it's NOT a in-place editing datagrid. One of...
2
by: Shiju Poyilil | last post by:
Hello, I have a datagrid with only one row and its having 2 dropdownlists, I need to populate the secodn dropdownlist on the basis of the selection in the first dropdown. but I am not able to...
10
by: Sacha Korell | last post by:
I'm trying to load a drop-down list with all DropDownList control names from another page. How would I be able to find those DropDownList controls? The FindControl method will only find a...
3
by: Schultz | last post by:
When using DropDownLists in ASP.NET VB 03 on Windows Server 2003 (IE 6) the selected values for Databound dropDowns is always the first item in the list, even after changing the selected item...
3
by: Mark Rae | last post by:
Hi, Apologies, but I appear to be having a senior moment... I have a standard DropDownList webcontrol with a SelectedIndexChanged event, as follows: <asp:TableCell ColumnSpan=4...
5
by: robert | last post by:
I have a dropdownlist with the autopostback set to true. I want the user to be confirm whether they do indeed want to change the value, which on post back fires a server side event...
1
by: Andy B | last post by:
I have a wizard that has 3 wizardSteps. The first one is selecting a NewsArticle from the combobox to edit. The second wizardStep (pressing next) loads the whole database record into a form. The...
0
by: asmx126453 | last post by:
Hey mensen I am having some big troubles here i tryd solving it myself with internet for 2 days but i kind fix it. Its about this i have a DotNet project that alrydi is online and working for...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.