Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > how can I create a properties collection for a user control

Reply
Thread Tools

how can I create a properties collection for a user control

 
 
news_server.nc.rr.com
Guest
Posts: n/a
 
      05-24-2005
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


 
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
create collection of collection Hemant ASP .Net 1 10-22-2009 03:04 PM
Designer Support: How to have user control's properties appear in IDE's properties window? Max2006 ASP .Net 2 07-13-2007 01:45 PM
Collection problems (create Collection object, add data to collection, bind collection to datagrid) Řyvind Isaksen ASP .Net 1 05-18-2007 09:24 AM
how can I create a properties collection for a user control news_server.nc.rr.com ASP .Net Web Controls 0 05-24-2005 08:13 PM
Reference a user controls properties from another user control?? =?Utf-8?B?YWJqb3Jr?= ASP .Net 1 05-05-2004 02:41 PM



Advertisments