User Control used in Repeater, but no output

Y

Yvonne

Hi,

I have a collection of objects, this objects contain url information, a
link to a picture and a descriptive text).
What I want to do is:
Displaying this data in a list of 'blocks' where each block is build of
the picture and the descriptive text surounded by a link.

I thought that this could be done with a repaeter hosting my user
control?

Am I right with this approach?

Kind regards, Yvonne
 
B

Brennan Stehling

Yvonne,

A repeater would work. You can also use a DataList control which is
meant to show rows and columns in a table. A repeater is much more
free form and each row is a template.

To do it with a User Control, you will need to handle a few more
details. What you could do is handle the events for the row being
bound to the row.

ItemDatabound may be the event for Repeater. And on your User Control
in the code-behind class, add public Properties which you can set in
that event handler. I use Properties to wrap the controls within the
User Control. Like my TextBox called TextBox1 may have a propert
called FirstName, and the Get and Set sections would Get and Set the
Text property on the TextBox1 control. Doing it this way exposes it
publicly to the parent control.

Then set each of them as the datasource is bound to the control.

Walk over it using the debugger to see how it is actually running.

Brennan Stehling
http://brennan.offwhite.net/blog/
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top