DropDownList Problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ring
    New Member
    • Nov 2006
    • 2

    DropDownList Problem

    Hi community, I'm having a problem,

    I dinamically create a table wich contains the results of a search, in each row of that table I create a dropdownlist called DD_ACTIONS and add this AddHandler DD_ACTIONS.Sele ctedIndexChange d, AddressOf DD_ACTIONS_Sele cted_Index_Chan ge[/I] in order to execute the code when the Selected Index Change, so the problem is that it works but only once because on the postback event of the page the table containing the dropdownlist is created again so the values of the dropdownlists are always the same, any suggestions???

    Regards...
  • mdaRock
    New Member
    • Nov 2006
    • 26

    #2
    Dear Ring,

    try to use the boolean function IsPostBack Page level to customize your query.

    If I miss somthing please post your filling code so we can modifay it togather.

    Regards.



    Originally posted by Ring
    Hi community, I'm having a problem,

    I dinamically create a table wich contains the results of a search, in each row of that table I create a dropdownlist called DD_ACTIONS and add this AddHandler DD_ACTIONS.Sele ctedIndexChange d, AddressOf DD_ACTIONS_Sele cted_Index_Chan ge[/I] in order to execute the code when the Selected Index Change, so the problem is that it works but only once because on the postback event of the page the table containing the dropdownlist is created again so the values of the dropdownlists are always the same, any suggestions???

    Regards...

    Comment

    • Ring
      New Member
      • Nov 2006
      • 2

      #3
      Thanks mdaRock

      when I create the table there is a cell where I create each dropdownlist, the code for add this cell is

      'DOCUMENT ACTIONS
      Dim TC_ACTION_ITEM As New TableCell
      TC_ACTION_ITEM. HorizontalAlign = HorizontalAlign .Right
      Dim DD_ACTIONS As New DropDownList
      AddHandler DD_ACTIONS.Sele ctedIndexChange d, AddressOf DD_ACTIONS_Sele cted_Index_Chan ge
      DD_ACTIONS.ID = myReader("Docum entID")
      DD_ACTIONS.Data Source = SqlDataSource1
      DD_ACTIONS.Data TextField = "FunctionNa me"
      DD_ACTIONS.Data ValueField = "FunctionID "

      'CREATE "CHOOSE ACTION" ITEM
      Dim liCA As New ListItem
      liCA.Text = "Choose Action"
      liCA.Value = "-1"

      'CREATE "OPEN DOCUMENT ACTION" ITEM
      Dim liOD As New ListItem
      liOD.Text = "Open Document"
      liOD.Value = "-2"

      DD_ACTIONS.Item s.Add(liCA)
      DD_ACTIONS.Item s.Add(liOD)
      DD_ACTIONS.Appe ndDataBoundItem s = True
      DD_ACTIONS.Auto PostBack = True
      DD_ACTIONS.Enab leViewState = True
      DD_ACTIONS.Data Bind()
      TC_ACTION_ITEM. Controls.Add(DD _ACTIONS)
      TR2.Cells.Add(T C_ACTION_ITEM)

      then on the DD_ACTIONS_Sele cted_Index_Chan ge Sub what I'm doing is this:

      Select Case sender.Selected Value
      Case "-1"
      'CHOOSE ACTION: DO NOTHING
      Case "-2"
      'CHECK(DATABASE )
      Case Else
      "DO SOMETHING
      End Select

      but the problem is that on the postback the cell that contains the dropdownlists needs to be created, an the postback ocurr before the DD_ACTIONS_Sele cted_Index_Chan ge Sub so each time you enter the Sub the selectedValue is the same it never change...



      Originally posted by mdaRock
      Dear Ring,

      try to use the boolean function IsPostBack Page level to customize your query.

      If I miss somthing please post your filling code so we can modifay it togather.

      Regards.

      Comment

      Working...