By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,306 Members | 1,621 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,306 IT Pros & Developers. It's quick & easy.

how can I create a properties collection for a user control

P: n/a
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)

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.

Nov 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.