Loop through a collection

F

Fresno Bob

I want to loop through a collection of objects in a for each loop and change
the value of one of the properties of the objects. When I go to bind to my
gridview the values haven't changed. How I solve this? I am guessing it is
something to do with reference vs value types but I am not quite sure. I
will be using vb.net regards. Chris.
 
S

Sulabh

make sure u modify the same instance of object that you are binding to
grid view....
it will easy to figure out wats going wrong if u can post the code.

~Sulabh
 
C

chris.kennedy

make sure u modify the same instance of object that you are binding to
grid view....
it will easy to figure out wats going wrong if u can post the code.

~Sulabh

For Each obj As CustomTypes.Customers In col
obj.id = intTmp
Next

All the objects in col don't have the new id value when I do the bind
to a gridview
 
C

comphilip

I guess that GridView finishes its data binding jobs before you change
values. You may explicit call GridView's DataBind method.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top