473,321 Members | 1,748 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,321 software developers and data experts.

if/then logic in a repeater control. best methods?

I go back and forth between repeater controls and just using good ol' string
builders to build formatted output from a db query.

I'm working on a project where I'd really like to keep all the formatting
markup on the front-end for the non-.net folks to be able to updates.
Obvioudly, a repeater control makes a lot of sense for this.

The challenge is that this is an events list, so my data may be:

10/2/07 event
10/7/07 event
11/22/07 event
12/14/07 event

The above in a repeater is easy enough, but I need to insert a month before
each item that starts in a new month. So, it needs to look like this:

October 2007
2 event
7 event

November 2007
22 event

December 2007
14 event

Any best practices for accomplishing that via a repeater control and/or
another way to keep the front-end markup on the front end (ie, not
compiled)?

I could move my if/then logic to the front end and use response.write for it
all, but that doesn't seem a very 'modern' solution.

-Darrel
Dec 16 '07 #1
3 1257
It's called grouping.

http://www.google.com/search?q=repeater+grouping

--

Riki

"Darrel" <no*****@nospam.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>I go back and forth between repeater controls and just using good ol'
string builders to build formatted output from a db query.

I'm working on a project where I'd really like to keep all the formatting
markup on the front-end for the non-.net folks to be able to updates.
Obvioudly, a repeater control makes a lot of sense for this.

The challenge is that this is an events list, so my data may be:

10/2/07 event
10/7/07 event
11/22/07 event
12/14/07 event

The above in a repeater is easy enough, but I need to insert a month
before each item that starts in a new month. So, it needs to look like
this:

October 2007
2 event
7 event

November 2007
22 event

December 2007
14 event

Any best practices for accomplishing that via a repeater control and/or
another way to keep the front-end markup on the front end (ie, not
compiled)?

I could move my if/then logic to the front end and use response.write for
it all, but that doesn't seem a very 'modern' solution.

-Darrel

Dec 16 '07 #2
It's called grouping.
>
http://www.google.com/search?q=repeater+grouping
Interesting. It appears that there's no 'built-in' way to handle this and
that one simply need to write a control that does just this.

Not sure the current project necessitates the time/effort for this, but will
certainly add this to my list of things to explore!

-Darrel
Dec 16 '07 #3
The way of doing this sort of things is to make an itemtemplate out of 2
rows, one for month and another for event. Then in the ItemDataBound, or
even better in the PreRender event, you can see if the event date passed
through a month boundary, you will set the month value and make the month
row visible. If the event is in the same month with the previous one, you
will make the month row hidden.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Darrel" <no*****@nospam.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>I go back and forth between repeater controls and just using good ol'
string builders to build formatted output from a db query.

I'm working on a project where I'd really like to keep all the formatting
markup on the front-end for the non-.net folks to be able to updates.
Obvioudly, a repeater control makes a lot of sense for this.

The challenge is that this is an events list, so my data may be:

10/2/07 event
10/7/07 event
11/22/07 event
12/14/07 event

The above in a repeater is easy enough, but I need to insert a month
before each item that starts in a new month. So, it needs to look like
this:

October 2007
2 event
7 event

November 2007
22 event

December 2007
14 event

Any best practices for accomplishing that via a repeater control and/or
another way to keep the front-end markup on the front end (ie, not
compiled)?

I could move my if/then logic to the front end and use response.write for
it all, but that doesn't seem a very 'modern' solution.

-Darrel

Dec 17 '07 #4

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

Similar topics

5
by: UnknownServices | last post by:
I've added a LinkButton to a repeater control and I set the link button as follows: <asp:LinkButton ID="DLLinkButton" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "DownloadID")%>'...
4
by: bill | last post by:
I have a Repeater control in a web user control. The web user control has a public method named PopulateRepeater which takes an ID as an parameter and populates the repeater control based on the...
8
by: fernandezr | last post by:
I would like to use a user control as a template inside a repeater. Some of the fields in the control should be hidden depending on whether or not there is data. I'm still a ASP .Net newbie so the...
7
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...
5
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: ...
12
by: Bob Jones | last post by:
I have an odd business requirement and I think that the implementation is not correct in the terms of OOP development. Any help on the concepts would be very appreciated! We currently have a...
6
by: Doogie | last post by:
I have a Repeater control in an app I'm updating. I need to write code (event method) when a user clicks on one of the columns in the control. But there is no method like "Repeater_OnClick" or...
1
by: =?Utf-8?B?QWxleCBNYWdoZW4=?= | last post by:
Hi. I'm trying to figure out how you do the most basic Data-Bound "Repeater" functionality on a Mobile ASPX page. I don't mean a list box, because it will have repeated HTML and User Controls in...
15
by: | last post by:
I dynamically create controls (textboxes) in a repeater control. I know their names (eg. TextBox1). How do I find the text of TextBox1 in the Form? FindControl does not seem to work.
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.