472,986 Members | 2,874 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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:DropDownList ID="ddlStatus" runat="server"
DataSourceID="sdsStatus"
DataTextField="Status" DataValueField="StatusID"
SelectedValue='<%# Bind("StatusID") %>'
AppendDataBoundItems="True">
<asp:ListItem Value="">(No selection)</asp:ListItem>
</asp:DropDownList>

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 1395
After some thinking, I've worked it out. I had optimistic concurrency set
on sdsStatus.

Removed "AND @original_StatusID = [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
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...
1
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...
1
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"...
0
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...
1
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...
3
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...
3
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"...
0
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...
3
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...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

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.