Home All Groups Group Topic Archive Search About

User Control used in Repeater, but no output

Author
14 Nov 2006 9:30 PM
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

Author
14 Nov 2006 10:24 PM
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/

Yvonne wrote:
Show quoteHide quote
> 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
Author
15 Nov 2006 1:18 PM
Yvonne
Thank you for the fast response.
Will try it like that.
Kind Regards, Yvonne


Brennan Stehling schrieb:

Show quoteHide quote
> 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/
>
> Yvonne wrote:
> > 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