I'm using the code below to set up a DetailsView and a LLBLGenDataSourceControl. There is one column SourceControlSystemID which needs to be inserted a specific value from the ASP.NET page, and which shouldn't be typed in on the DetailsView.
I've tried a few approaches and can't this to work as NULLs are inserted into the column value rather values such as 1 or 2. Approaches tried include
1) DetailsView - Removing the BoundField for this field.
2) LLBLGenDataSourceControl - Changing the InsertParameter in the vssDatabaseDetailView_ItemInserting event so the DefaultValue property has the value say 1.
3) LLBLGenDataSourceControl - In the vssDatabaseDetailView_ItemInserting event change the value by accessing the Values property from the DetailsViewInsertEventArgs instance passed in.
Any thoughts would be appreciated?
<asp:DetailsView ID="vssDatabaseDetailView" runat="server" AutoGenerateRows="False" DataKeyNames="SourceControlDatabaseId" Height="50px" Width="125px" OnItemInserted="vssDatabaseDetailView_ItemInserted" DataSourceID="llbGenSourceControlDatabaseDataSource" OnItemDeleted="vssDatabaseDetailView_ItemDeleted" OnItemInserting="vssDatabaseDetailView_ItemInserting" OnItemUpdated="vssDatabaseDetailView_ItemUpdated" AutoGenerateDeleteButton="True" AutoGenerateEditButton="True" AutoGenerateInsertButton="True">
<Fields>
<asp:BoundField DataField="FileLocation" HeaderText="FileLocation" SortExpression="FileLocation" />
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
<asp:BoundField DataField="Password" HeaderText="Password" SortExpression="Password" />
<asp:BoundField DataField="UserName" HeaderText="UserName" SortExpression="UserName" />
<asp:BoundField DataField="SourceControlDatabaseId" HeaderText="SourceControlDatabaseId"
ReadOnly="True" SortExpression="SourceControlDatabaseId" Visible="False" />
<asp:BoundField DataField="SourceControlSystemId" HeaderText="SourceControlSystemId"
SortExpression="SourceControlSystemId" Visible="False" InsertVisible="False" />
</Fields>
</asp:DetailsView>
<cc1:LLBLGenProDataSource ID="llbGenSourceControlDatabaseDataSource" runat="server"
DataContainerType="EntityCollection" EntityCollectionTypeName="MyApp.CollectionClasses.SourceControlDatabaseCollection, MyApp">
<InsertParameters>
<asp:Parameter Name="SourceControlSystemID" Type="Int32" />
</InsertParameters>
</cc1:LLBLGenProDataSource>