Tech Off Thread

2 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

FormView + DropDownList + ObjectDataSource Problem

Back to Forum: Tech Off
  • User profile image
    BugFree

    Hi All,

    Hope this will be an easy one for you, but I can't figure it out!

    I have a formview on the webpage that displays information about a product. One of the values I need to display is a list of delivery options.

    These options come from a database table and are bound to the drop down via a ObjectDataSource.

    In the formview I want to bind the ProductDeliveryTypeId to the Id in the DropDownList, however I also need to add in a "N/A" option.

    I don't want the "Not Applicable" option in the DeliveryTypes table.

    Now, when I display the form I get an error telling me "'deliveryOption' has a SelectedValue which is invalid because it does not exist in the list of items. Parameter name: value"

    How can I manually add in the Not Applicable option to the dropdown at runtime?

    I've tried adding it on form load, FormView load and get the same error or another error because the dropdownlist hasn't been created yet.

    I know the code I have to add in the "NA" item is good becuase it works in another page.

    Please help!

    Cheers

  • User profile image
    BugFree

    Sorted...

    AppendDataBoundItems="true"

    http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=281



Conversation locked

This conversation has been locked by the site admins. No new comments can be made.