ASP.NET Insert Only Details View with Drop Down List

Woopedi

New Member
I am using ASP.NET webforms and Entity Framework. I'm trying to have just a simple insert form using a Details View. I do not want to edit, delete, or select entries from this Details View, only Insert new entries.In the insert, I want to insert new people.The structure of a person is: Name, Manager, LocationI have two Entity Data Sources, one that represents Managers and one that represents LocationsI have two DropDownLists in the InsertItemTemplate that can select manager and location.My problem is that when I place the DetailsView (DefaultMode = insert) and add the data source for the people entity, the DetailsView shows an entry from the database as well as the drop down lists and name fields. I might be missing something simple but I can't seem to get a DetailsView for insert only that has DropDownLists populated by other Entity Data Sources.\[code\] <asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="125px" DefaultMode="Insert" AutoGenerateInsertButton="True"> <Fields> <asp:BoundField DataField = "Name" /> <asp:TemplateField> <InsertItemTemplate> <asp:DropDownList DataSourceID = "ManagerEntitySource" runat="server" /> </InsertItemTemplate> <InsertItemTemplate> <asp:DropDownList DataSourceID = "LocationEntitySource" runat="server" /> </InsertItemTemplate> </asp:TemplateField> </Fields> </asp:DetailsView> <asp:EntityDataSource ID="AddEmployeeDataSource" runat="server" ConnectionString="name=SafetyEntities" DefaultContainerName="SafetyEntities" EnableFlattening="False" EnableInsert="True" EntitySetName="Employees"> </asp:EntityDataSource>\[/code\]
 
Back
Top