2 way databinding with dropdownlist and nullable field

Posts   
 
    
JasonCoder
User
Posts: 4
Joined: 12-Jun-2007
# Posted on: 12-Jun-2007 01:18:18   

Hullo.

I'm 5 days into my evaluation of your product and I have to say it's a solid piece of software. Coming from wilson's O/R mapper I'm enjoying the datasource controls and better query functions.

My issue that I don't seem to be able to find a good way around is that of 2-way databinding to a dropdownlist control inside a formview. So, I have a formview that inside of the editItemTemplate I have a dropdownlist that looks like this:


<asp:DropDownList ID="lstPriAdmin" runat="server" DataSourceID="lgpdsPerson" DataTextField="FullName"
                                DataValueField="PersonGuid" SelectedValue='<%# Bind("PrimaryAdminGuid") %>' AppendDataBoundItems="True">
                                <asp:ListItem Text="Select" Value=""></asp:ListItem>
                            </asp:DropDownList>

The value for PrimaryAdminGuid is potentially null.

Now before, with the objectDataSource control I didn't have any problems and for null values the item "select" was selected in the dropdownlist. With your control I get: 'lstPriAdmin' has a SelectedValue which is invalid because it does not exist in the list of items. Parameter name: value

This is probably some setting I have overlooked but I haven't found anything on the forums that is on point with my issue. Please help.

Regards,

JasonCoder

JasonCoder
User
Posts: 4
Joined: 12-Jun-2007
# Posted on: 12-Jun-2007 02:09:00   

Unbelievable. It suddenly started working. Ignore/delete this post.

Thanks.