Implementing cascading DropDownList binding in a templated control

后端 未结 4 605
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-03 04:21

I have 2 DropDownList controls on my form, the second of which uses the SelectedValue of the first as one of its binding parameters.

Both <

4条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-03 05:08

    This may come a little bit late but better late than never:

    Protected Sub DetailsView1_ItemUpdating(sender As Object, e As System.Web.UI.WebControls.DetailsViewUpdateEventArgs) Handles DetailsView1.ItemUpdating
      e.NewValues("AtendeeSubType") = DirectCast(DirectCast(sender, DetailsView).FindControl("dropdownlist3"), DropDownList).SelectedValue
    End Sub
    

    I tested this for the event ItemUpdating of a details view but I think it will work for a formview, just switch the parts you need and it will work.

    Edit: You can check this reference: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.detailsview.itemupdating.aspx

提交回复
热议问题