473,670 Members | 2,447 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Data Repeater - Dynamic template depending on data

I have a repeater that I need to display one of three different templates,
depending on a status bit in the data (e.g. if status = 0, display a basic
template, 1 = with picture, 2 = with picture + extra text)

Is this possible? If so, does anyone have a link to a good tutorial or
example?

Thanks in advance,

Duncan
Nov 17 '05 #1
3 5882
Hi,

Well you have two choises:
1- Create 3 Repeaters and bind/show the needed one. This is the easiest
solution just that you create two controls that you know for sure you will
not use. Even so I believe this is the way to go.
2- Create the ItemTemplate collection to build the control as needed, this
is more error prone and you will need more code for it.
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Dunc" <du**@ntpcl.f9. co.uk> wrote in message
news:uC******** ******@TK2MSFTN GP09.phx.gbl...
I have a repeater that I need to display one of three different templates,
depending on a status bit in the data (e.g. if status = 0, display a basic
template, 1 = with picture, 2 = with picture + extra text)

Is this possible? If so, does anyone have a link to a good tutorial or
example?

Thanks in advance,

Duncan

Nov 17 '05 #2
Sorry - think I phrased that badly. One list could potentially contain all
three different layouts, at any given location.

Any other thoughts?

Duncan
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us > wrote
in message news:ud******** *****@tk2msftng p13.phx.gbl...
Hi,

Well you have two choises:
1- Create 3 Repeaters and bind/show the needed one. This is the easiest
solution just that you create two controls that you know for sure you will
not use. Even so I believe this is the way to go.
2- Create the ItemTemplate collection to build the control as needed, this
is more error prone and you will need more code for it.
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Dunc" <du**@ntpcl.f9. co.uk> wrote in message
news:uC******** ******@TK2MSFTN GP09.phx.gbl...
I have a repeater that I need to display one of three different templates,
depending on a status bit in the data (e.g. if status = 0, display a basic
template, 1 = with picture, 2 = with picture + extra text)

Is this possible? If so, does anyone have a link to a good tutorial or
example?

Thanks in advance,

Duncan


Nov 17 '05 #3
Hi,

It does not matter, the list is the datasource, the repeaters are just the
way you will show it, are the repeaters the one that show it differently.

I still think the idea of having 3 repeaters and showing only the one you
want is the best option

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Dunc" <du**@ntpcl.f9. co.uk> wrote in message
news:eu******** ******@TK2MSFTN GP09.phx.gbl...
Sorry - think I phrased that badly. One list could potentially contain
all three different layouts, at any given location.

Any other thoughts?

Duncan
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us >
wrote in message news:ud******** *****@tk2msftng p13.phx.gbl...
Hi,

Well you have two choises:
1- Create 3 Repeaters and bind/show the needed one. This is the easiest
solution just that you create two controls that you know for sure you
will not use. Even so I believe this is the way to go.
2- Create the ItemTemplate collection to build the control as needed,
this is more error prone and you will need more code for it.
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Dunc" <du**@ntpcl.f9. co.uk> wrote in message
news:uC******** ******@TK2MSFTN GP09.phx.gbl...
I have a repeater that I need to display one of three different
templates, depending on a status bit in the data (e.g. if status = 0,
display a basic template, 1 = with picture, 2 = with picture + extra
text)

Is this possible? If so, does anyone have a link to a good tutorial or
example?

Thanks in advance,

Duncan



Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3292
by: hendrik.vanniekerk | last post by:
Hi I'm using a repeater control doing databinding to an array at runtime. I have created a Template class for creating Headertemplate Itemtemplate etc. creating databinding at runtime. It contains an eventhandler that is added to the Databinding event of the repeater control In the Microsoft help it is said that the ItemCommand event of the repeater control will not capture an embedded
0
3311
by: Nilesh W | last post by:
Hi I am using data repeater in my application to display data. Header template for data repeater I want add at run time because the header text for item columns read from some other resources Then how to add header template with header text for each column in data repeater at run time Thanks and regard Nilesh W
1
1936
by: Henry Nelson | last post by:
Hi all I'm very new to dotNet and just trying to get my head around the right way to do the thing that I would normally do in asp. In asp I would loop through a recordset and output all the html dynamically for the layout I want. I have seen some examples of using a repeater and they seem to be the thing to use when you don't want a table of results, but I'm not sure how to change the <ItemTemplate> depending on the contents of the...
4
1493
by: Joel | last post by:
Hey all- I'm new to asp.net so please bear with me -- I'm attempting to reference the repeater's Container.DataItem outside the repeater object. In other words -- In a seperate sub routine: if the repeater's Container.DataItem == Something -> Do Action. How do I reference the Container.DataItem in by sub routine (And thus outside the repeater object)?
5
5802
by: Matt Jensen | last post by:
Am I right in saying that you can't have a Radiobutton web control inside a repeater bound to a database datasource and (inline) dynamically set it's ID and text properties from the repeaters rows? This is the impression I've got after extensive searching and trial and error, even thought I have to say I find it hard to believe? Thanks Matt
9
3526
by: hazz | last post by:
I want to display 'n' records for a table-driven data entry page. The first column should be readonly and the 2nd column, a checkbox WRITABLE (NOT READONLY). I can't use the gridview because it creates -> checked="checked" disabled="disabled" What I need is more like this; <form id="form1" runat="server"> <div> <table>
7
2999
by: | last post by:
I have what's probably a simple page lifecycle question related to dynamically evaluating values that are placed by a repeater and dynmically placing user controls that use those values. I'm attempting to bind a user control I've written, "ImageBox", to a repeater. The user control takes a custom property, "ContentID", that will execute a database lookup and load an image.
5
3844
by: Brad Baker | last post by:
I am trying to make a "tabbed" interface by iterating through a dataset with a conditional statement. For example: ---------------------------------------------------------------------------------------------------------------------- | <a href="config.aspx?siteid=FIEJGIE">Site 1</a| Site 2 | <a href="config.aspx?siteid=DFOWEMF">Site 3</a>| In the example above site 2 is the "current" tab. I have the following code at the top of my...
3
3950
by: Emma Middlebrook | last post by:
Hi there, I've been trying to implement a repeater control in an ASP.NET 2 page but I can't seem to get the layout exactly how I want and I'm not sure if it's something that I am doing wrong or maybe the repeater control doesn't have the capabilities...? The page needs to display a custom number of sections that appear the same but have different data..
0
8469
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8903
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8814
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7419
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6213
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4391
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2800
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2042
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1794
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.