Velocity Reviews - Computer Hardware Reviews

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

Reply
Thread Tools

SelectionList DataValueField problem

 
 
Brad Wist
Guest
Posts: n/a
 
      07-30-2003
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.


 
Reply With Quote
 
 
 
Reply

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



Advertisments