If dvRecipeItem.CurrentMode = DetailsViewMode.Insert Then ddRecipeItemNumber.Items.Clear() End If
but if the insert event gets cancelled, then this happens to the drop down
If dvRecipeItem.CurrentMode = DetailsViewMode.ReadOnly Then ddRecipeItemNumber.DataBind() End If
then the drop down goes back to contain all the values from datasource. but what happens to the details view is that instead that picking up the value from the drop down list, it goes to the default value = 1 that is specified in the entity datasource, and if I remove that default value, and then try to insert a new item, and cancel before saving it, then the details view disappears although the dropdownlist does contain a value. seems like it is not binding back.
<asp:EntityDataSource ID="EntityDataSource_RecipeItemDetail" runat="server" ConnectionString="name=OLTPEntities" DefaultContainerName="OLTPEntities" EnableFlattening="False" EntitySetName="RefineRecipe" Where="it.Id = @RecipeId" EnableDelete="True" EnableInsert="True" EnableUpdate="True" EntityTypeFilter="RefineRecipe"> <WhereParameters> <asp:ControlParameter ControlID="ddRecipeItemNumber" DbType="Int32" DefaultValue="1" Name="RecipeId" PropertyName="SelectedValue" /> </WhereParameters> </asp:EntityDataSource>
I would like to ask for help in order to figure out how to assign the drop down value to the details view on this event insert/ cancel
Any help would be nice, really.
Thank you very much.