D
David C
I have a web page with a dropdownlist which uses a SqlDatasource and a
SelectCommand to show selections from a table. However, when I postback
(going into Edit mode) on a FormView I get the error "'ddlGroups' has a
SelectedValue which is invalid because it does not exist in the list of
items.
Parameter name: value"
I am changing the options in the page_load as follows:
Select Case txtGroup.Text
Case "", "SLPC", "Sybron"
SqltlkpGroups.SelectCommand = "SELECT NULL As Groups UNION SELECT [Groups]
FROM [tlkpGroups] ORDER BY [Groups]"
Case Else
SqltlkpGroups.SelectCommand = "SELECT NULL As Groups UNION SELECT [Groups]
FROM [tlkpGroups] WHERE [Active] <> 0 ORDER BY [Groups]"
End Select
This works fine, but when I click the edit button I get the SelectedValue
error above. How can I handle this simple condition of either displaying
active or all selections? Thanks.
David
SelectCommand to show selections from a table. However, when I postback
(going into Edit mode) on a FormView I get the error "'ddlGroups' has a
SelectedValue which is invalid because it does not exist in the list of
items.
Parameter name: value"
I am changing the options in the page_load as follows:
Select Case txtGroup.Text
Case "", "SLPC", "Sybron"
SqltlkpGroups.SelectCommand = "SELECT NULL As Groups UNION SELECT [Groups]
FROM [tlkpGroups] ORDER BY [Groups]"
Case Else
SqltlkpGroups.SelectCommand = "SELECT NULL As Groups UNION SELECT [Groups]
FROM [tlkpGroups] WHERE [Active] <> 0 ORDER BY [Groups]"
End Select
This works fine, but when I click the edit button I get the SelectedValue
error above. How can I handle this simple condition of either displaying
active or all selections? Thanks.
David