Hmm, I removed the "SelectedValue" attribute, and now the page loads, but the drop-down is blank. I have a feeling that there's something missing in how I'm declaring/populating the drop-down and how it's being displayed. Perhaps I have created two of them, and the local one is getting populated and the global one is getting displayed?
So this is probably not a Castle/ActiveRecord question anymore, but if anyone could point me to a HOWTO properly use a DropDownList within a ListView, I'd appreciate it. On Sep 16, 1:51 pm, Chris Curvey <[email protected]> wrote: > 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 -~----------~----~----~----~------~----~------~--~---
