selectedValue property in dropdownlist of detailsview??
Posted on 2008-10-20
I am having a little problem with the NULL and emtpy value of the records from the database.
I am trying to bind a dropdownlist to the detailsview in edit mode.
I am getting the selectedvalue is not in the list item of values.
The dropdownlist values come from dstatus field of table1(id,dstatus).
The dstatus field has the following values (active,inactive,pass,fail).
the values of detailsview come from this table called table2(id,name,status)
I want to put a dropdown in edit mode of detailsview.
The status field contains both null and empty values including active,inactive,pass,fail.
How do I need to handle the null and empty?
<asp:DropDownList ID="DropDown1" runat="server" SelectedValue='<%# Bind("status") %>'
DataValueField="dstatus" DataTextField="dstatus" AppendDataBoundItems="True" DataSourceID="DSdStatus">
The Dropdownlist basically has the following values:active,inactive,pass,fail.
The values of status in the table2 are active,inactive,pass,fail, NULL and EMPTY.
Since NULL and EMPTY values are not in the dropdownlist, it is erroring out.
How do I need to handle this??