I am trying to update a property of an object called Book
. On the web form, the user makes a selection using a drop down list, and after pressing the save
button, a postback is triggered to save the data.
Every other property is being saved correctly like title, subject, author, etc, but this one property in the drop down list is never being saved.
I don't get any errors when I trace it, but I see that both the text
and value
property of the ddlSpecialtyName
is empty even though the user has selected a value.
Here is the code:
Private Sub CreateTest_LoadComplete(sender As Object, e As EventArgs) Handles Me.LoadComplete
If IsPostBack Then
Using tran = DbSession.BeginTransaction()
Book.SpecialtyName = ddlSpecialtyName.SelectedItem.Text
DbSession.Update(Book)
tran.Commit()
End Using
End If
End Sub
And the ddl control:
<asp:DropDownList ID="ddlSpecialtyName" runat="server" AppendDataBoundItems="true">
</asp:DropDownList>