Hi Robin,
I am not exactly sure what you're asking. AppendDataBoundItems is not related to the actual queries or data source controls. What AppendDataBoundItems does is keep items you define in markup view when items from a data source are added. So, when you have a "Please make a selection" item, it's preserved when you then add items from a data source.
The errors you may get are probably related to the value sent to the query based on the item in the drop down. Imagine an item like this:
Code:
<asp:DropDownList ID="DropDownList1" runat="server" AppendDataBoundItems="true">
<asp:ListItem Value="Select Something">Please make a selection</asp:ListItem>
</asp:DropDownList>
Now, consider what happens when you choose this item.
Code:
int photoAlbumId = Convert.ToInt32(ddlPhotoAlbum.SelectedValue);
This will crash as you cannot convert the string "Select Something" to an integer.
You could assign a non existing integer to the ListItem:
Code:
<asp:ListItem Value="-1">Please make a selection</asp:ListItem>
or you can assign an empty string:
Code:
<asp:ListItem Value="">Please make a selection</asp:ListItem>
and then skip the code when the item is empty:
Code:
if (!string.IsNullOrEmpty(ddlPhotoAlbum.SelectedValue))
{
int photoAlbumId = Convert.ToInt32(ddlPhotoAlbum.SelectedValue);
... Remaining code here
}
Does this help?
Imar