Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > DataValueField - postback

Reply
Thread Tools

DataValueField - postback

 
 
Mike
Guest
Posts: n/a
 
      09-04-2003
I haven't been able to find any posts about this problem.
When I set the DataValueField to be something, the control
loses it's selected index when returning from the
postback. If I set only the DataTextField I have no
problems.

I set the DataTextField and DataValueFields like so:

ddlBU.DataTextField="BU"; -- each value is unique
ddlBU.DataValueField = "ORG_ID"; -- is 1 of 2 values

It seems that the because Org_Id is not unique in the
dataset it is screwing up the index of the control by
setting the SelectedIndex to be the first ListItem it
finds with a DataValueField matching that of the
originally selected item.

Anyone know of a work around ?
 
Reply With Quote
 
 
 
 
Alvin Bruney
Guest
Posts: n/a
 
      09-08-2003
why don't you manually set the selected item to the value of the item you
are looking for
selectedindex = 9; for 10th item
"Mike" <(E-Mail Removed)> wrote in message
news:22f101c3732a$ce92e560$(E-Mail Removed)...
> I haven't been able to find any posts about this problem.
> When I set the DataValueField to be something, the control
> loses it's selected index when returning from the
> postback. If I set only the DataTextField I have no
> problems.
>
> I set the DataTextField and DataValueFields like so:
>
> ddlBU.DataTextField="BU"; -- each value is unique
> ddlBU.DataValueField = "ORG_ID"; -- is 1 of 2 values
>
> It seems that the because Org_Id is not unique in the
> dataset it is screwing up the index of the control by
> setting the SelectedIndex to be the first ListItem it
> finds with a DataValueField matching that of the
> originally selected item.
>
> Anyone know of a work around ?



 
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
listbox datavaluefield and datatextfield tshad ASP .Net 3 05-10-2005 05:35 AM
Dropdownlist,DataTextField,DataValueField ? Sam ASP .Net 1 02-18-2005 11:52 AM
Advantage of DataValueField =?Utf-8?B?U3VuaWwgU2FiaXI=?= ASP .Net 3 02-01-2005 02:56 PM
Concatenating Multiple Values for DataValueField =?Utf-8?B?UkY=?= ASP .Net 6 12-03-2004 05:15 PM
DropdownList, DataValueField, DataTextField and Custom Collections.. Parodi Development ASP .Net 0 09-10-2004 06:29 PM



Advertisments