SelectionList DataValueField problem

Discussion in 'ASP .Net Mobile' started by Brad Wist, Jul 30, 2003.

  1. Brad Wist

    Brad Wist Guest

    I've got a set of code that is attempting to build a SelectionList. The
    values are not sequential. I bind the control to a dataset in which the
    values being passed are correct. But the values that are entered into the
    selectionlist are simple sequential indexes.

    Am I missing something here? Or is this a bug in data binding with the
    SelectionList?

    Here's the code:


    daUnits.Fill(dsMyList);

    selUnit.DataSource = dsUnitList;

    selUnit.DataTextField = "sName";

    selUnit.DataValueField = "Id";

    selUnit.DataBind();



    And here is an excerpt of the source data

    <dbo_spListUnit>
    <Id>58</Id>
    <sCode>Unit1 </sCode>
    <sName>First Unit</sName>
    </dbo_spListUnit>
    <dbo_spListUnit>
    <Id>230</Id>
    <sCode>UnitC </sCode>
    <sName>Second Unit</sName>
    </dbo_spListUnit>
    <dbo_spListUnit>
    <Id>119</Id>
    <sCode>UnitX </sCode>
    <sName>Third Unit</sName>
    </dbo_spListUnit>

    The name appears fine in the list, but the values are consistently 0, 1, 2,
    etc... sequential through the list, and do not include the "id" value from
    the source data.

    Thanks.
    Brad Wist, Jul 30, 2003
    #1
    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. Parodi Development
    Replies:
    0
    Views:
    3,639
    Parodi Development
    Sep 10, 2004
  2. Sanjay Sood

    SelectionList Problem

    Sanjay Sood, Jul 17, 2003, in forum: ASP .Net Mobile
    Replies:
    1
    Views:
    133
  3. Ran

    Databound SelectionList Problem

    Ran, Aug 11, 2003, in forum: ASP .Net Mobile
    Replies:
    0
    Views:
    129
  4. leezard

    SelectionList problem

    leezard, Aug 17, 2003, in forum: ASP .Net Mobile
    Replies:
    1
    Views:
    133
    duncan mason
    Aug 21, 2003
  5. domchik
    Replies:
    0
    Views:
    145
    domchik
    Sep 2, 2003
Loading...

Share This Page