how can I create a properties collection for a user control

Discussion in 'ASP .Net' started by news_server.nc.rr.com, May 24, 2005.

  1. 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
     
    news_server.nc.rr.com, May 24, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian
    Replies:
    2
    Views:
    2,145
    BMukes
    May 28, 2004
  2. Øyvind Isaksen
    Replies:
    1
    Views:
    1,000
    Øyvind Isaksen
    May 18, 2007
  3. Max2006
    Replies:
    2
    Views:
    521
    Max2006
    Jul 13, 2007
  4. Hemant

    create collection of collection

    Hemant, Oct 22, 2009, in forum: ASP .Net
    Replies:
    1
    Views:
    428
    Gregory A. Beamer
    Oct 22, 2009
  5. news_server.nc.rr.com

    how can I create a properties collection for a user control

    news_server.nc.rr.com, May 24, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    126
    news_server.nc.rr.com
    May 24, 2005
Loading...

Share This Page