How do I refer to data from nested web user control?

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

  1. How do i perform a databind on a web user control within a repeater or
    rather
    how can I access the datasource that is already bound? I have a web user
    control that displays a table of values (the profile of a piece of
    equipment)
    from SQLServer. I've used a repeater on the webform since a query (i.e. by
    address) against the DB may return multiple machine profiles and I want to
    use the repeater to display as many machine profiles as are returned by the
    DB.

    for each field in on the web user control I've tried using something like
    the following to access each field value:

    DataBinder.Eval(Container.DataItem, "Name")
    (where FIELD_NAME is the name of the column I'd like to reference.)

    This method will work if I place the repeater on the web user control (and
    make it public or create a property for its datasource) rather than the
    webform but what I'd like to do is to create the repeater control on my
    webform and then include the webusercontrol inside the repeater's item
    template. However, when I do this the above method for refering to the
    field
    value no longer works. I get error messages saying that container is not a
    member of web.ui.controls. I found a semi-relavent posting which suggested
    I
    use:

    DataBinder.Eval(Container, "DataItem.FIELD_NAME")

    However this does not work either. How can this be achieved?
    news_server.nc.rr.com, May 20, 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. Mike Hnatt
    Replies:
    6
    Views:
    471
    Mike Hnatt
    Oct 23, 2003
  2. Joe Fallon

    User Control needs to refer to Page

    Joe Fallon, Feb 12, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    2,352
    Joe Fallon
    Feb 12, 2004
  3. Jerry Qu
    Replies:
    1
    Views:
    466
    lee atkinson
    Feb 20, 2009
  4. Bryan Holland

    Refer to a custom property of a dynamically loaded user control

    Bryan Holland, Nov 17, 2003, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    174
    Dave Rothgery
    Nov 17, 2003
  5. news_server.nc.rr.com

    How do I refer to data from nested web user control?

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

Share This Page