Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How do i perform a databind on a web user control within a repeate

Reply
Thread Tools

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

 
 
=?Utf-8?B?bWlrZQ==?=
Guest
Posts: n/a
 
      05-16-2005
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?

 
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
Hosting a user control within a user control Charlie@CBFC ASP .Net 2 10-15-2005 08:55 PM
How do i perform a databind on a web user control within a repeate mike ASP .Net Web Controls 0 05-16-2005 01:44 PM
User Control within User Control - Event not firing Don ASP .Net 3 03-11-2005 05:56 PM
Problem doing DataBind on a control within a DataList? Olav Tollefsen ASP .Net 2 12-29-2004 02:10 PM
BUG in DataBind? After .DataBind there are more DataGrid Items than DataSet Rows! Michael ASP .Net Datagrid Control 0 12-29-2003 07:47 PM



Advertisments