Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Mobile > SelectionList DataValueField problem

Thread Tools

SelectionList DataValueField problem

Brad Wist
Posts: n/a
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

Here's the code:


selUnit.DataSource = dsUnitList;

selUnit.DataTextField = "sName";

selUnit.DataValueField = "Id";


And here is an excerpt of the source data

<sCode>Unit1 </sCode>
<sName>First Unit</sName>
<sCode>UnitC </sCode>
<sName>Second Unit</sName>
<sCode>UnitX </sCode>
<sName>Third Unit</sName>

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.


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
DropdownList, DataValueField, DataTextField and Custom Collections.. Parodi Development ASP .Net 0 09-10-2004 06:29 PM
selectionList and datareader problem - Please Help!! domchik ASP .Net Mobile 0 09-02-2003 02:15 PM
SelectionList problem leezard ASP .Net Mobile 1 08-21-2003 10:59 AM
SelectionList Problem Sanjay Sood ASP .Net Mobile 1 08-12-2003 02:00 AM
Databound SelectionList Problem Ran ASP .Net Mobile 0 08-11-2003 10:38 PM