473,698 Members | 2,932 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dropdown in Formview not updating as expected

Hi all,

== brief version ==

using ASP 2.0, I have a ddl inside a formview. On update, if the ddl starts
as NULL, no update happens. If the ddl has a bound value that is not NULL,
then all updates happen as expected.

How do I resolve this pleeeaase??!! :-)
== detailed version ==

using ASP 2.0, I have the following scenario representing systems with a
status on each one. So we have a FormView (say fvSystem) bound to a
SQLDataSource (say sdsSystem) containing a dropdownlist (say ddlStatus)
containing values from another SQLDataSource (say sdsStatus), with its
SelectedValue bound to an ID field (say StatusID) in fvSystem (using
sdsSystem).

Pseud-schematically:

FormView (fvSystem) =(datasource) sdsSystem, which contains:
DropDownList (ddlStatus) =(datasource) sdsStatus, bound to StatusID
(from fvSystem).

In sdsSystem, StatusID is often null so the ddl looks like:

<asp:DropDownLi st ID="ddlStatus" runat="server"
DataSourceID="s dsStatus"
DataTextField=" Status" DataValueField= "StatusID"
SelectedValue=' <%# Bind("StatusID" ) %>'
AppendDataBound Items="True">
<asp:ListItem Value="">(No selection)</asp:ListItem>
</asp:DropDownLis t>

Much of the operation is perfect:

- when StatusID is null, the ddl displays the "(No selection)" item as
expected,
- on update, if StatusID is not null, all changes are updated correctly
(including choosing "(No selection)".

However, on Update (during an Edit), if StatusID starts as a null value,
changing the selection always returns a null.

This has almost made me go bald and I'm sure it's an easy fix. If anyone
can help (I've Googled myself silly here) I would be extremely grateful.

Many regards,
Dave E (Sydney)
Dec 2 '06 #1
1 1437
After some thinking, I've worked it out. I had optimistic concurrency set
on sdsStatus.

Removed "AND @original_Statu sID = [StatusID]" from the UpdateCommand for
sdsSystem and Bob was my Aunty!!

Hope this may help anyone reading... tough one to crack for me.

Cheers,
Dave E (Sydney)
Dec 2 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3878
by: Michael Glass | last post by:
I'm working on an ASP.Net web app using VS2005 and the .Net 2.0 framework, and I have a serious problem with the page I'm currently working on. The page has, among other things, two FormViews and a GridView control, each with its own SqlDataSource. FormView1 talks to my Opportunity table and has an ItemTemplate and an EditItemTemplate. FormView2 talks to my Activities table and has an ItemTemplate, InsertItemTemplate and an...
1
2585
by: yuchang | last post by:
Hi, Using the FormView control is very efficient. But I want to do some action,like showing a success message or redirect to another page, after inserting, updating and deleting. How do I get these message?
1
6823
by: Dabbler | last post by:
I have a FormView tied to ObjectDataSource that's not updating and am wondering what I missed.. <asp:FormView ID="fvRegDetail" runat="server" DefaultMode="Edit" DataKeyNames="RegistrantId" DataSourceID="odsRegistrant" CssClass="waFormView" > <EditItemTemplate> .... <asp:Button ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update" Text="Update" ValidationGroup="regForm">
0
1844
by: TJHerman | last post by:
I have a dropdown list in a Formview that includes a number of fields in the SQLDatasource. I want to be able to get the value of one of the fields in the Datasource that is not the Datatextfield or the Datavaluefield from within a Formview control. I know that I can get the data text field or datavalue field by using the following: -Dim ddlCompanyName as DropDownList
1
1337
by: Jerome | last post by:
Hi, I'm using a FormView for data entry and it works fine so far. With one exception: I replaced one of the automatically generated textfields by a dropdown list and the value from that list does not get saved in the database! I know that it's because it's missing in the <InsertParameters> section but how do I reference it there!? How do I tell the FormView to save the value from this dropdown list in field x from my table? This has...
3
1851
by: Dave | last post by:
I have 2 Dropdown's in a Web FormView. I would like to get one to be a Parameter for the other, but I can't seem to figure out how to get the value out of the first. When I double click it to get to the C# Window...neither of the Dropdowns are available to get the Value or set a profile. How can I get this Value?
3
3636
by: J055 | last post by:
Hi I have a PlaceHolder control inside a FormView EditItemTemplate: <asp:PlaceHolder ID="phResponseText" runat="server"> <tr> <td> <asp:Label ID="lblResponseText" runat="server"></asp:Label></td> <td> <asp:TextBox ID="tbResponseText" runat="server" Text='<%#
0
1988
by: =?Utf-8?B?TGFkaXNsYXYgTXJua2E=?= | last post by:
Hello, I read some msdn and other articles about how does databinding among DataSource controls and FormView / GridView controls works but I still don't fully understand to this blackbox. I have few questions and hopefully you can provide me some answers. 1. Best place for DataBinding. Where is the best place for calling DataBind method? Is it possible to say don't bind controls for this postback and use current values instead? These...
3
8096
by: KaOne | last post by:
Hi All, excuse me in advance for my not very perfect english. I need some help about a problem with a FormView bounded to an ObjectDataSource. In practise I have an ObjectDataSource that uses some BLL methods that implements the optimistic concurrency by a TimeStamp field into the DB. So, when I execute an insert, update or delete query if I receive 0 like return value from that queries I understand that a concurrency problem is occurs so...
0
8611
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9170
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8904
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8876
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7741
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6531
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4624
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2341
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.