I have a real basic thing....I have two classes: Envelope and
LetterType with a foreign key relationship between them
(Envelope.LetterTypeId = LetterType.Id)
I'm trying to create a form that will list each Envelope (in a
ListView) and let the user pick the LetterType from a DropDownList.
So in my ItemEditing event (in C#) I have:
letterTypeList.DataSource = LetterType.FindAll();
letterTypeList.DataBind();
envelopeList.DataSource = Envelope.FindAll();
envelopeList.DataBind();
And then in my ASPX page, I have:
<asp:DropDownList runat="server" ID="letterTypeList"
DataTextField="Name"
DataValueField="Id" SelectedValue='<%# Bind
("LetterType.Id") %>'
AppendDataBoundItems="true" />
But I can't get the incantation right. I keep getting "
'letterTypeList' has a SelectedValue which is invalid because it does
not exist in the list of items. Parameter name: value"
I've even gone so far as to default Envelope.LetterTypeId to zero in
the database, and then put in a "zero" entry in my list of
LetterTypes.
I can't be the first person doing this. Can someone point out the
error of my ways?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---