selected value error

J

JohnE

I have a form view that when it goes to Edit I am running into an error on
any drop list. The following is a sample from one of the drop list.

'ddlEDMSCategoryID' has a SelectedValue which is invalid because it does not
exist in the list of items.

The drop list is filled using a sqldatasource. It is below;

<asp:SqlDataSource ID="EDMSCategoryEditSqlDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:proteusConnectionString %>"
SelectCommand="SELECT EDMSCategoryID, EDMSCategory
FROM tblEDMSCategory
ORDER BY EDMSCategory ASC">
</asp:SqlDataSource>

The source code for the drop list is;

<th>EDMS Category:</th>
<td><asp:DropDownList ID="ddlEDMSCategoryID" runat="server"
DataSourceID="EDMSCategoryEditSqlDataSource"
Width="100px"
DataTextField="EDMSCategory"
DataValueField="EDMSCategoryID"
SelectedValue='<%# Bind("EDMSCategoryID") %>'>
</asp:DropDownList></td>

I am puzzled as why I am getting this. I have tested the SelectCommand in
the management studio and it returns exactly what is needed. The table
(tblChangeRequest) has the field it is bound to so it does exist.

There are records in which the field (EDMSCategoryID) in the
tblChangeRequest are empty (null). It is not necessary for a user to
complete the field for each record.

Can someone inform me as to what is missing or a way to fix this?

Thanks... John
 
J

JohnE

No need to respond. I have figured out a work-a-round to the issue.
Thanks to anyone who took the time to read this post.
John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top