views:

15

answers:

1

Given the following InsertItemTemplate (simplified) I'm not getting anything back in the event object's Values collection.

<InsertItemTemplate>
            Item: 
            <asp:DropDownList ID="ItemInsertType"  
                     DataTextField="SearchItemName"
                     DataValueField="SearchItemID" runat="server" />
            Hide Location:
            <asp:TextBox ID="txtItemHideLocation" Text='<%# Bind("HideLocation") %>' runat="server"></asp:TextBox>
            <asp:Button ID="btnSearchSearchItemInsert" CommandName="Insert" runat="server" Text="Add" />
            <asp:Button ID="btnSearchSearchItemInsertCancel" CommandName="Cancel" runat="server" Text="Cancel" />
</InsertItemTemplate>

I'm binding the listview to a collection attached to my nHibernate model object (SearchObject.SearchItems). This collection doesn't have insert or update handling like an object datasource would, so I want to handle the insert/update events manually. Is there a way to get these values to come through automatically, or do I have to manually grab each value from its control when I handle this event?

+1  A: 

Hello,

I was using reflector on that assembly, and it looks to me (could be wrong) that it only supports IBindableControl controls for automatic extraction into the Values collection. So Values would not contain an entry for any non-IBindableControl-supporting controls. TextBox does not implement this, nor does DropDownList.

I typically use the InsertItem property and extract the control references directly using FindControl.

HTH.

Brian