how do you add an attribute to the dropdownlist then perform a databind

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Trafton
    New Member
    • Aug 2010
    • 2

    how do you add an attribute to the dropdownlist then perform a databind

    I am trying to add an attribute to a dropdownlist control to store a value returned for the database. This value is need to get a code once a selection is made on the dropdownlist;

    I have tried the following:

    ddlStatus.DataT extField = dsValues.Tables (0).Columns("De scription").ToS tring()
    ddlStatus.DataV alueField = dsValues.Tables (0).Columns("Ca tegoryCode").To String()
    ddlStatus.Attri butes.Add("SysC ode", dsValues.Tables (0).Columns("Sy stemCode").ToSt ring())
    ddlStatus.DataB ind()

    but the attribute is not bound to the control
  • MrMancunian
    Recognized Expert Contributor
    • Jul 2008
    • 569

    #2
    For as far as I know, you cannot add attributes like that to a DropDownList. I'd suggest you handle it in the SelectedIndexCh ange Eventhandler.

    Steven

    Comment

    • Trafton
      New Member
      • Aug 2010
      • 2

      #3
      Okay, thanks

      Comment

      Working...