473,387 Members | 1,582 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 3623
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.FieldName")%></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**************@TK2MSFTNGP12.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.FieldName")%></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.Collections.HashTable shownUsers = new ....;

In the ItemDataBound event, do something like this:

DataRowView view = (DataRowView)e.Item.DataItem;
Label lblUserName = (Label)e.Item.FindControl("lblUserName");
if (shownUsers.ContainsKey(view["UserIDFieldName"].ToString())
{
// Already shown, don't really have to do anything.
}
else
{
// Go ahead and plug in the name field.
lblUserName.Text = view["UserNameFieldName"].ToString();
// Add them to the hashtable of already displayed users.
shownUsers.Add(
new DictionaryEntry(
view["UserIDFieldName"].ToString(),
view["UserNameFieldName"].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**************@TK2MSFTNGP12.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.FieldName")%></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 #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**********@hotmail.com (Eric) wrote in message news:<53************************@posting.google.co m>...
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
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> <%#...
5
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...
3
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="<%#...
3
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. ...
3
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...
1
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...
1
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...
0
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...
5
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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...
0
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,...

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.