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="<%$ ConnectionStringsroteusConnectionString %>"
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><aspropDownList ID="ddlEDMSCategoryID" runat="server"
DataSourceID="EDMSCategoryEditSqlDataSource"
Width="100px"
DataTextField="EDMSCategory"
DataValueField="EDMSCategoryID"
SelectedValue='<%# Bind("EDMSCategoryID") %>'>
</aspropDownList></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
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="<%$ ConnectionStringsroteusConnectionString %>"
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><aspropDownList ID="ddlEDMSCategoryID" runat="server"
DataSourceID="EDMSCategoryEditSqlDataSource"
Width="100px"
DataTextField="EDMSCategory"
DataValueField="EDMSCategoryID"
SelectedValue='<%# Bind("EDMSCategoryID") %>'>
</aspropDownList></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