Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Listbox DataValueField

Reply
Thread Tools

Listbox DataValueField

 
 
Gerald
Guest
Posts: n/a
 
      06-23-2005
Hi,

Is it possible to do some action on the value that will be the
DataValueField of a listbox?

I have a listbox with a list of item. But I would like to encode the value
ID that the client will see in the html.
There is no way to do that on the database, it has to be done on the .net
side.

For instance:

I have
SearchID.DataSource = oReader;
SearchID.DataValueField = "Value";
SearchID.DataTextField = "Text";
SearchID.DataBind ();

And I would like to have something like:

SearchID.DataSource = oReader;
SearchID.DataValueField = EncodeID("Value");
SearchID.DataTextField = "Text";
SearchID.DataBind();

EncodeID being whatever you want, just a simple function.

I dont want to loop through anything and would like if possible to keep the
databinding stuff.

Another option would be to response.write the listitem, but again, I want to
keep the four lines there and apply a function to it.

Thanks for your help.

Gerald



 
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 Gerald ASP .Net 0 06-22-2005 04:18 PM
listbox datavaluefield and datatextfield tshad ASP .Net 3 05-10-2005 05:35 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