HighTechTalks DotNet Forums  

Dropdown in Formview not updating as expected

Dotnet General Discussions microsoft.public.dotnet.general


Discuss Dropdown in Formview not updating as expected in the Dotnet General Discussions forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Dave E
 
Posts: n/a

Default Dropdown in Formview not updating as expected - 12-02-2006 , 01:32 AM






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:

<aspropDownList ID="ddlStatus" runat="server"
DataSourceID="sdsStatus"
DataTextField="Status" DataValueField="StatusID"
SelectedValue='<%# Bind("StatusID") %>'
AppendDataBoundItems="True">
<asp:ListItem Value="">(No selection)</asp:ListItem>
</aspropDownList>

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)



Reply With Quote
  #2  
Old   
Dave E
 
Posts: n/a

Default Re: Dropdown in Formview not updating as expected - 12-02-2006 , 03:41 AM






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)



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.