DropDownList: Accesing the columns values

Discussion in 'ASP .Net Web Controls' started by WhiskeyRomeo, Oct 4, 2007.

  1. WhiskeyRomeo

    WhiskeyRomeo Guest

    I have a ddl bound to a sqldatasource which returns 4 columns. It is easy to
    access two of them since one serves as the datavaluefield and the other as
    the datatextfield. But how do I access the other columns' values in the
    selecteditem of the ddl?

    I was expecting to see something like this:

    ddl1.selecteditem.columns("whatevercolumnIwant").value but, of course, that
    does not exist.

    Any help is appreciated.

    WR
     
    WhiskeyRomeo, Oct 4, 2007
    #1
    1. Advertising

  2. WhiskeyRomeo

    WhiskeyRomeo Guest

    David,

    Thank you for the reply.

    The dropdown list is actually a list of available appointments retrieved via
    a stored procedure:

    SELECT Cast(Cast(DayDT as Varchar(11)) + ' ' + StartTime12 AS DateTime) AS
    APPT, DayDT, StartTime24, StartTime12
    FROM tblOrgTimeSlot
    WHERE (Org_ID = @Org_ID)AND(Taken < Capacity)
    ORDER BY DayDT, StartTime24

    So APPT is the datavaluefield and datatextfield. So an item looks like

    9/30/2007 9:00 AM, 9/25/2007, 0900, 8:00 AM

    The customer only sees first column and the first column is what makes each
    item unique. But rather than string manipulate the Appt back into it parts I
    just want the StartTime24 and DayDT value.

    I can do this via a Infragistic combobox or I can use a dataset as the
    dataource. I was just hoping I could do this using the MS standard ddl.

    Bill

    "David R. Longnecker" wrote:

    > WR-
    >
    > Unless you extend the DropDownList control and add a bit more functionality,
    > they only take two columns (a key/value pair) of information--one that is
    > associated to the textual display and one behind the scenes for the value.
    > When the HTML is generated, the KV pair is translated into:
    >
    > <option value="__yourValueParameter__">__yourTextFieldParameter__</option>
    >
    > How are you wanting to use your other two columns? Append them as potential
    > ListItems in the DropDownList control? If you could post an example of your
    > code, that'd be helpful.
    >
    > -dl
    >
    > --
    > David R. Longnecker
    > http://blog.tiredstudent.com
    >
    > > I have a ddl bound to a sqldatasource which returns 4 columns. It is
    > > easy to access two of them since one serves as the datavaluefield and
    > > the other as the datatextfield. But how do I access the other
    > > columns' values in the selecteditem of the ddl?
    > >
    > > I was expecting to see something like this:
    > >
    > > ddl1.selecteditem.columns("whatevercolumnIwant").value but, of
    > > course, that does not exist.
    > >
    > > Any help is appreciated.
    > >
    > > WR
    > >

    >
    >
    >
     
    WhiskeyRomeo, Oct 4, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Valentin Tihomirov

    Structural VHDL - Accesing signals of instances

    Valentin Tihomirov, Nov 1, 2003, in forum: VHDL
    Replies:
    2
    Views:
    573
    Paul Uiterlinden
    Nov 2, 2003
  2. Gönen EREN

    Accesing Items in datalist edittemplate

    Gönen EREN, Aug 22, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    646
    Gönen EREN
    Aug 22, 2003
  3. KH
    Replies:
    0
    Views:
    356
  4. Hrvoje Vrbanc
    Replies:
    3
    Views:
    737
    =?Utf-8?B?RFdT?=
    Mar 7, 2006
  5. deepak kumar

    accesing values of htmldropdownlist on server side?

    deepak kumar, Oct 30, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    114
    deepak kumar
    Oct 30, 2004
Loading...

Share This Page