Web Design and Development Forums

DropDownList not submitting to db

This is a discussion on "DropDownList not submitting to db" within the ASP.NET Forum section. This forum, and the thread "DropDownList not submitting to db are both part of the Program Your Website category.


Go Back   Webforumz.com > Program Your Website > ASP.NET Forum

Welcome to Webforumz.com.
Register Now Register now!

Reply
 
LinkBack Thread Tools Rate Thread
Old Oct 2nd, 2007, 10:23   #1 (permalink)
New Member
 
Join Date: Sep 2007
Location: London
Age: 28
Posts: 4
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???


<form id="form1" runat="server">
<div>
<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">
<SelectParameters>
<asp:QueryStringParameter Name="ID" QueryStringField="ID" />
</SelectParameters>
<UpdateParameters>
<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" />
</UpdateParameters>
</asp:SqlDataSource>
&nbsp;&nbsp;<asp:SqlDataSource ID="StatusSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:PublicationsListConnectionString %>"
SelectCommand="SELECT * FROM [Status]">
</asp:SqlDataSource>
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataSourceID="SqlDataSource1"
Height="50px" Width="125px">
<Fields>
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="StatusLabel" runat="server" Text='<%# Bind("Status") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="StatusID" runat="server" DataSourceID="StatusSqlDataSource"
DataTextField="Status" DataValueField="StatusID" AutoPostBack="True">
</asp:DropDownList>
</EditItemTemplate>
</asp:TemplateField>
<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" />
</Fields>
</asp:DetailsView>
</div>
</form>
RubyRue is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Oct 3rd, 2007, 10:59   #2 (permalink)
Rob
Head Admin & CEO
 
Rob's Avatar
 
Join Date: Jul 2003
Location: bug busting new style
Age: 34
Posts: 3,311
Blog Entries: 7
Send a message via MSN to Rob Send a message via Skype™ to Rob
Re: DropDownList not submitting to db

I would check that your primary key column is an autonumber field.

Also, try writing the SQL string (I'm sure you can get to that) to the screen to make sure the syntax is correct.

Lastly, try checking the submitted data is valid and that nessesary fields have been filled in.

Maybe there is a field in the database that is required, and you have not included a box for it on the form perhaps?
__________________
Rob Collyer - SEO Specialist (8 years+)
Owner & Founder of Webforumz.com

My Mrs's site:- Student Midwife Forums

I am currently unavailable for private work
-------------------------------------------------
Rob is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Submitting Forms cewgirl Beginner Resources 7 Sep 12th, 2007 20:28
How long between self-submitting and SE results? Donny Bahama Search Engines 8 Aug 30th, 2007 20:02
asp:DropDownList autopostback breepupetstofight ASP.NET Forum 0 Aug 22nd, 2007 14:04
self submitting forms madhuri.t ASP Forum 1 May 22nd, 2006 10:29
Submitting Graphics Amanda Graphics Forum 0 Jan 25th, 2006 17:30



Latest Updates

All Points SEO Security Advisory - CHECK YOUR SITE NOW!

Creative Coding :: February 2008

Webforumz is sponsored by: WESH UK Web Hosting
All times are GMT. The time now is 13:54.

Sleep Study Scoring :: Free Bet :: Website Templates :: Online Betting :: Bookmakers :: Funny Quotes :: Internet Recruitment Software :: Microsoft CRM Experts :: Online Casino :: Decorated Christmas Trees :: Midwife Forums :: Football Betting :: Ecommerce Software :: Web Hosting :: Football Stats :: Dry Cleaning Collection :: xtreme wales - extreme clothing :: Apuestas :: Sharepoint Consultants :: Website Optimisation :: Office Clearance London :: Sharepoint Experts :: Sports Betting :: Casino :: Website Templates :: Web Design Development India :: Online Gambling

Powered by: vBulletin Version 3.7, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
© 2003-2008 Webforumz.com : All Rights Reserved
Search Engine Friendly URLs by vBSEO 3.2.0 RC6


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59