I would like to ask for help regarding an asp page with a list view.
I want to get the Id value for the selected row, so that I can query the entity framework, get the record and delete it.
Down below is the code for when I do the e.Command = "Delete"
If e.CommandName = "Delete" Then
Dim myContext As New OLTPEntities
Dim myRecipeStepsHistory = myContext.RefineRecipeStep.Where("it.Recipe_Id=" & Me.lvRecipeSteps.FindControl("Recipe_Id").ToString())
Dim strRefineRecipeStepRecord = New StringBuilder("")
If Not IsNothing(myRecipeStepsHistory) Then
strRefineRecipeStepRecord.Append("Recipe_Id: " & Me.lvRecipeSteps.FindControl("Recipe_Id").ToString() & ", ")
I get an Object reference not set to an instance of an object, message.
Dim myRecipeStepsHistory = myContext.RefineRecipeStep
=" & Me.lvRecipeSteps.FindContr
ring()) << this line, I thinkis because I am not looking for the right control?
I have attached a copy of my aspx code. Hopefully some one will be able to provide guidance on this problem.
Thank you much.