|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
User Control used in Repeater, but no outputHi,
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 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 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
Login control - image button with text over it
how to get selectedvalue of radiobuttonlist in Javascript? looping through formview controls List Box : help preventing duplicate items Searching for a powerfull calendar addon GridView EnableSortingAndPagingCallBacks Select command. Accessing USER CONTROL which is inside Masterpage through Another USER Control inside normal page. Use CSS in themes Session sharing between ASP and ASP.NET get a filename for a bitmap in a skin |
|||||||||||||||||||||||