467,911 Members | 1,447 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,911 developers. It's quick & easy.

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
  • viewed: 1221
Share:
1 Reply
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Jerome | last post: by
3 posts views Thread by J055 | last post: by
reply views Thread by =?Utf-8?B?TGFkaXNsYXYgTXJua2E=?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.