how can I create a properties collection for a user control

  • Thread starter news_server.nc.rr.com
  • Start date
N

news_server.nc.rr.com

How can I create a properties collection for a user control? (or reference
what's there if it already exist)

I have a user control that displays an HTML table with several values. For
each field's value I have a public property that is set from a repeater's
itemdatabound event. In the ItemDataBound Sub, I use something like the
following where the datasource column name is always the same as the form's
property name:

DisplayTable.FIELD1 = DataBinder.Eval(e.Item.DataItem, "FIELD1")

I have to go through and set approx. 30 fields just like this but I'd like
to do something that is completely independent of the number of columns
returned plus I'd rather not have to name each property or field should one
be deleted or added.... Something like:

dim x as property
for each x in MyUserControlInstance.PropertiesCollection
MyUserControlInstance..x= DataBinder.Eval(e.Item.DataItem, x)
next

I've tried several different approaches but can't get it working . The
compiler identifies the .x part after the control name as the source of the
error. I can't recall right this second if the message was 'identifier
expected' or 'expression expected' but I think it was one of these.

Mike
 

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,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top