468,272 Members | 2,066 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,272 developers. It's quick & easy.

How do i perform a databind on a web user control within a repeate

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 in the web user control (and
make it public or create a property for the 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?

Nov 19 '05 #1
0 1412

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by autofill | last post: by
1 post views Thread by tal_mcmahon | last post: by
reply views Thread by Alexandre Brisebois (www.pointnetsolutions.com) | last post: by
2 posts views Thread by Andy Fish | last post: by
2 posts views Thread by Olav Tollefsen | last post: by
1 post views Thread by Aayush Puri | last post: by
1 post views Thread by Craig | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.