473,666 Members | 2,131 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can I achieve Rowspan capabilities using the ASP:Repeater control

Hello,
I have the following dataset that I want to bind to a repeater to be
displayed as a table.

Owner Animal Volume
---------------------------
Eric Dog 6
Eric Cat 3
Eric Gerbil 1
Eric Bird 10
Jenny Dog 2
Jenny Cat 4

I'd like to have an ASP repeater return a table that looks like the
following.
Specifically not adding the "Owner" over and over again. I'd like the
owner to shop up on the first entry only.
_______________ ______________
|Owner Animal Volume |
-----------------------------
|Eric Dog 6 |
| Cat 3 |
| Gerbil 1 |
| Bird 10 |
|Jenny Dog 2 |
| Cat 4 |
-----------------------------

I've been messing with this for a while but I have a feeling that the
repeater isn't capable of doing this. This is easy enough in "old
school" ASP but I'm having trouble getting it to work in ASP.net.

Any help would be greatly appreciated.

Thanks

Eric
Nov 18 '05 #1
4 3634
Go to HTML view of the ASPX, then hop in between your asp:Repeater
element tags and create a <HeaderTemplate >. In there, put your starting
table element and the first row (or tableheader, whichever you want).
Create a <FooterTemplate > closing out the table tags you put in the
<HeaderTemplate >. The IDE isn't smart enough to figure out what you're
doing, so depending on your build warning level, you may see warnings in
your output whining about a missing close tag for the table (but it'll
still compile). In the <ItemTemplate >, put table rows for your data.
<tr><td><%# DataBinder.Eval (Container,
"DataItem.Field Name")%></td></tr>, etc.

Eric wrote:
Hello,
I have the following dataset that I want to bind to a repeater to be
displayed as a table.

Owner Animal Volume
---------------------------
Eric Dog 6
Eric Cat 3
Eric Gerbil 1
Eric Bird 10
Jenny Dog 2
Jenny Cat 4

I'd like to have an ASP repeater return a table that looks like the
following.
Specifically not adding the "Owner" over and over again. I'd like the
owner to shop up on the first entry only.
_______________ ______________
|Owner Animal Volume |
-----------------------------
|Eric Dog 6 |
| Cat 3 |
| Gerbil 1 |
| Bird 10 |
|Jenny Dog 2 |
| Cat 4 |
-----------------------------

I've been messing with this for a while but I have a feeling that the
repeater isn't capable of doing this. This is easy enough in "old
school" ASP but I'm having trouble getting it to work in ASP.net.

Any help would be greatly appreciated.

Thanks

Eric


--
-----
Aaron Lewis
GuildPortal.com Development
www.guildportal.com

Nov 18 '05 #2
hmmmm.....I've gotten this far already but it's still showing multiple
entries for Eric and Jenny. I want to get a rowspan effect that only
shows the Owners column value for the first row that appears. I don't
see how this solution alllows for the addition of rowspan
capabilities. Any ideas? Thank you in advance.

This is what I want:
Eric Dog 6
Cat 3
Gerbil 1
Bird 10
Jenny Dog 2
Cat 4

Not this:
Eric Dog 6
Eric Cat 3
Eric Gerbil 1
Eric Bird 10
Jenny Dog 2
Jenny Cat 4
Aaron Lewis <aa************ **@guildportal. comSTOPSpam> wrote in message news:<#S******* *******@TK2MSFT NGP12.phx.gbl>. ..
Go to HTML view of the ASPX, then hop in between your asp:Repeater
element tags and create a <HeaderTemplate >. In there, put your starting
table element and the first row (or tableheader, whichever you want).
Create a <FooterTemplate > closing out the table tags you put in the
<HeaderTemplate >. The IDE isn't smart enough to figure out what you're
doing, so depending on your build warning level, you may see warnings in
your output whining about a missing close tag for the table (but it'll
still compile). In the <ItemTemplate >, put table rows for your data.
<tr><td><%# DataBinder.Eval (Container,
"DataItem.Field Name")%></td></tr>, etc.

Eric wrote:
Hello,
I have the following dataset that I want to bind to a repeater to be
displayed as a table.

Owner Animal Volume
---------------------------
Eric Dog 6
Eric Cat 3
Eric Gerbil 1
Eric Bird 10
Jenny Dog 2
Jenny Cat 4

I'd like to have an ASP repeater return a table that looks like the
following.
Specifically not adding the "Owner" over and over again. I'd like the
owner to shop up on the first entry only.
_______________ ______________
|Owner Animal Volume |

-----------------------------
|Eric Dog 6 |
| Cat 3 |
| Gerbil 1 |
| Bird 10 |
|Jenny Dog 2 |
| Cat 4 |
-----------------------------

I've been messing with this for a while but I have a feeling that the
repeater isn't capable of doing this. This is easy enough in "old
school" ASP but I'm having trouble getting it to work in ASP.net.

Any help would be greatly appreciated.

Thanks

Eric

Nov 18 '05 #3
Ohhhhh, my apologies! I didn't know that your data was joined that way.
In this case, you're absolutely right, there is nothing that the
Repeater has that can intrinsically handle it for ya.

What you *can* do, is in your <ItemTemplate > in the first <TD>, place
something like:

<asp:Label ID=lblUserName Runat=Server></asp:Label>

Then create an event handler of the ItemDataBound event for the
DataRepeater. At the page level, store an arraylist or hashtable or
some other type of collection called something like:

private System.Collecti ons.HashTable shownUsers = new ....;

In the ItemDataBound event, do something like this:

DataRowView view = (DataRowView)e. Item.DataItem;
Label lblUserName = (Label)e.Item.F indControl("lbl UserName");
if (shownUsers.Con tainsKey(view["UserIDFieldNam e"].ToString())
{
// Already shown, don't really have to do anything.
}
else
{
// Go ahead and plug in the name field.
lblUserName.Tex t = view["UserNameFieldN ame"].ToString();
// Add them to the hashtable of already displayed users.
shownUsers.Add(
new DictionaryEntry (
view["UserIDFieldNam e"].ToString(),
view["UserNameFieldN ame"].ToString()
)
);
}

Give that a shot, hope it helps!

Eric wrote:
hmmmm.....I've gotten this far already but it's still showing multiple
entries for Eric and Jenny. I want to get a rowspan effect that only
shows the Owners column value for the first row that appears. I don't
see how this solution alllows for the addition of rowspan
capabilities. Any ideas? Thank you in advance.

This is what I want:
Eric Dog 6
Cat 3
Gerbil 1
Bird 10
Jenny Dog 2
Cat 4

Not this:
Eric Dog 6
Eric Cat 3
Eric Gerbil 1
Eric Bird 10
Jenny Dog 2
Jenny Cat 4
Aaron Lewis <aa************ **@guildportal. comSTOPSpam> wrote in message news:<#S******* *******@TK2MSFT NGP12.phx.gbl>. ..
Go to HTML view of the ASPX, then hop in between your asp:Repeater
element tags and create a <HeaderTemplate >. In there, put your starting
table element and the first row (or tableheader, whichever you want).
Create a <FooterTemplate > closing out the table tags you put in the
<HeaderTempla te>. The IDE isn't smart enough to figure out what you're
doing, so depending on your build warning level, you may see warnings in
your output whining about a missing close tag for the table (but it'll
still compile). In the <ItemTemplate >, put table rows for your data.
<tr><td><%# DataBinder.Eval (Container,
"DataItem.Fie ldName")%></td></tr>, etc.

Eric wrote:

Hello,
I have the following dataset that I want to bind to a repeater to be
displayed as a table.

Owner Animal Volume
---------------------------
Eric Dog 6
Eric Cat 3
Eric Gerbil 1
Eric Bird 10
Jenny Dog 2
Jenny Cat 4

I'd like to have an ASP repeater return a table that looks like the
following.
Specifical ly not adding the "Owner" over and over again. I'd like the
owner to shop up on the first entry only.
____________ _______________ __
|Owner Animal Volume |


-----------------------------
|Eric Dog 6 |
| Cat 3 |
| Gerbil 1 |
| Bird 10 |
|Jenny Dog 2 |
| Cat 4 |
-----------------------------

I've been messing with this for a while but I have a feeling that the
repeater isn't capable of doing this. This is easy enough in "old
school" ASP but I'm having trouble getting it to work in ASP.net.

Any help would be greatly appreciated.

Thanks

Eric


--
-----
Aaron Lewis
GuildPortal.com Development
www.guildportal.com

Nov 18 '05 #4
That did the trick. Many thanks.
I enjoy ASP.net very much but I suppose this is one of those areas
where ASP 3.0 can still be worlds more efficient than ASP.net.
er**********@ho tmail.com (Eric) wrote in message news:<53******* *************** **@posting.goog le.com>...
Hello,
I have the following dataset that I want to bind to a repeater to be
displayed as a table.

Owner Animal Volume
---------------------------
Eric Dog 6
Eric Cat 3
Eric Gerbil 1
Eric Bird 10
Jenny Dog 2
Jenny Cat 4

I'd like to have an ASP repeater return a table that looks like the
following.
Specifically not adding the "Owner" over and over again. I'd like the
owner to shop up on the first entry only.
_______________ ______________
|Owner Animal Volume |
-----------------------------
|Eric Dog 6 |
| Cat 3 |
| Gerbil 1 |
| Bird 10 |
|Jenny Dog 2 |
| Cat 4 |
-----------------------------

I've been messing with this for a while but I have a feeling that the
repeater isn't capable of doing this. This is easy enough in "old
school" ASP but I'm having trouble getting it to work in ASP.net.

Any help would be greatly appreciated.

Thanks

Eric

Nov 18 '05 #5

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

Similar topics

0
1596
by: Joe Fawcett | last post by:
I'm having a problem binding an asp:repeater control to a Hashtable. Originally my code was: <asp:Repeater id="rptFamily" runat="server" DataSource="<%# family %>"> <ItemTemplate> <%# DataBinder.Eval(Container.DataItem, "Key") %> = <%# DataBinder.Eval(Container.DataItem, "Value") %> </ItemTemplate> </AlternatingItemTemplate> </asp:Repeater>
5
8256
by: Scott Lyon | last post by:
I am having a strange problem. The program is a bit complex, but I'll try to simplify what I can. I apologize if this is complicated, but I think this would still be simpler than posting a bunch of source code. If you want me to post code, though, just say so. In a nutshell, I've got an ASP.NET application that has one main ASPX page. On that ASPX page, it has a user control (an ASCX) that displays the actual data and controls I need.
3
1903
by: John Giblin | last post by:
I have an asp repeater control which I am trying to assign the datasorce to it inline. Here is my code. <asp:Repeater ID="AddOnList" DataSource="<%# BasketLineDAO.GetByEventCategory(content.Id,10)%>" Runat=server> This does not work. I do not get any rows from the repeater. but when I assign the datasource and bind it in the behing code, I do get the rows
3
2046
by: Kelly Leahy | last post by:
I'm using an Asp:Repeater control with a text box in the item templates. This is for a system that has a number of items that the user can edit and I'd like to generate them based on a list. However, when the user clicks a save button (not in the asp:repeater, but on the form itself) I would like to (on postback) update the values in the database and redisplay the page. I can't figure out how to reference the controls generated by...
3
2533
by: Joe Fawcett | last post by:
Sorry about the multi post, I thought I'd sent to both groups simultaneously but somehow it failed to find this one the first time. I'm having a problem binding an asp:repeater control to a Hashtable. Originally my code was: <asp:Repeater id="rptFamily" runat="server" DataSource="<%# family %>"> <ItemTemplate> <%# DataBinder.Eval(Container.DataItem, "Key") %> = <%# DataBinder.Eval(Container.DataItem, "Value") %>
1
6414
by: ratnakarp | last post by:
Hi, I have a search text box. The user enters the value in the text box and click on enter button. In code behind on button click i'm writing the code to get the values from the database and binding it to a repeater control. This repeater control has multiple text boxes and buttons. Can you please tell me how can i do paging in this case ? I'm posting my code below. The problem is that if i click on "AdjustThisAd" button, it opens...
1
4891
by: Fred Dag | last post by:
As far as I can work out when using the OnTextChanged event I cannot get the TextBox and Labels values when the event fires as they are populated by a <asp:repeater and so don't have values. If I try to give the repeater values by removing if (!IsPostBack) {} from the
0
2558
by: Eugene Anthony | last post by:
The problem with my coding is that despite removing the records stored in the array list, the rptPages repeater control is still visible. The rptPages repeater control displayes the navigation link (1,2,3 so on). The code can be found in SubscriptionCart.aspx.cs. Default.aspx ------------
5
4795
by: RC- | last post by:
Hi everyone, I have been searching and searching for an answer to this question using Google and what not; I have not been able to find a "clear cut" answer. OK, now the question: I have a Repeater control that works great. What I am trying to do is perform an active count of the number of rows that the repeater is rendering. The end goal is to insert a page break after six rows of data. I cannot figure out how to count the rows one...
0
8444
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
8356
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8869
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
8639
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7386
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...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4368
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1775
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.