0

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>
dovid
  • 6,354
  • 3
  • 33
  • 73
SkyeBoniwell
  • 6,345
  • 12
  • 81
  • 185

1 Answers1

1

Hi Set the autopostback property to true for dropdown.

Sekhar Babu
  • 368
  • 2
  • 8
  • 27