How set dropdownlist in detailsview?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bobby Edward

    #1

    How set dropdownlist in detailsview?

    Pretty simple webform layout...

    - Categories dropdownlist (used as a filter for gridview): ddlCategory
    - Gridview
    - DetailsView used ONLY for insert into the Gridview

    (All of this is contained in an UpdatePanel - using Ajax)

    In the InsertTemplate of the DetailsView I use a dropdown for "Category". I
    want it to ALWAYS be the same as the Categories dropdownlist at the top of
    the webform. So, I tried this, but it doesn't work...

    Protected Sub ddlCategory_Sel ectedIndexChang ed(ByVal sender As Object,
    ByVal e As System.EventArg s) Handles ddlCategory.Sel ectedIndexChang ed
    CType(dvInsert. FindControl("dd lCategoryInsert "),
    DropDownList).S electedIndex = ddlCategory.Sel ectedIndex
    End Sub

    If I debug I can see the SelectedIndex change, but it doesn't show up
    properly.

    Any idea why? Thanks!


Working...