473,503 Members | 12,516 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Grid View: How to show a date header?

Hello,

I have created a GridView on runtime by implementing the ITemplate
class.

This Gridview displays a list of articles. Each article has a Title,
Content and PubDate.

I am trying to create a Date Header like in a blog, i.e., display the
date on top of every daily posts.

For example:

Wednesday, 25 of April of 2007

Article 3 (PubDate: 25.04.2007 # 20:15)

Article 2 (PubDate: 25.04.2007 # 11:30)

Article 1 (PubDate: 25.04.2007 # 08:40)

Wednesday, 24 of April of 2007

Article 2 (PubDate: 24.04.2007 # 21:32)

Article 1 (PubDate: 24.04.2007 # 15:45)

How can I created the date header as I described?

Thanks,

Miguel

Apr 25 '07 #1
4 2251
I'm not sure the GridView control is the best choice for this kind of
display.
Perhaps another control would be better, such as a Table control or
repeater.

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net
"shapper" <md*****@gmail.comwrote in message
news:11**********************@t38g2000prd.googlegr oups.com...
Hello,

I have created a GridView on runtime by implementing the ITemplate
class.

This Gridview displays a list of articles. Each article has a Title,
Content and PubDate.

I am trying to create a Date Header like in a blog, i.e., display the
date on top of every daily posts.

For example:

Wednesday, 25 of April of 2007

Article 3 (PubDate: 25.04.2007 # 20:15)

Article 2 (PubDate: 25.04.2007 # 11:30)

Article 1 (PubDate: 25.04.2007 # 08:40)

Wednesday, 24 of April of 2007

Article 2 (PubDate: 24.04.2007 # 21:32)

Article 1 (PubDate: 24.04.2007 # 15:45)

How can I created the date header as I described?

Thanks,

Miguel
Apr 25 '07 #2
Miguel,
you can use the RowDataBound event, and check if the rowtype is Header, then
set the text you want, like:

If e.Row.RowType = DataControlRowType.Header Then
e.Row.Cells(0).Text = Now.ToString
End If

Bruno

"shapper" <md*****@gmail.comwrote in message
news:11**********************@t38g2000prd.googlegr oups.com...
Hello,

I have created a GridView on runtime by implementing the ITemplate
class.

This Gridview displays a list of articles. Each article has a Title,
Content and PubDate.

I am trying to create a Date Header like in a blog, i.e., display the
date on top of every daily posts.

For example:

Wednesday, 25 of April of 2007

Article 3 (PubDate: 25.04.2007 # 20:15)

Article 2 (PubDate: 25.04.2007 # 11:30)

Article 1 (PubDate: 25.04.2007 # 08:40)

Wednesday, 24 of April of 2007

Article 2 (PubDate: 24.04.2007 # 21:32)

Article 1 (PubDate: 24.04.2007 # 15:45)

How can I created the date header as I described?

Thanks,

Miguel

Apr 25 '07 #3
On Apr 25, 6:29 pm, "Steve C. Orr [MCSD, MVP, CSM, ASP Insider]"
<S...@Orr.netwrote:
I'm not sure the GridView control is the best choice for this kind of
display.
Perhaps another control would be better, such as a Table control or
repeater.

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsiderhttp://SteveOrr.net

"shapper" <mdmo...@gmail.comwrote in message

news:11**********************@t38g2000prd.googlegr oups.com...
Hello,
I have created a GridView on runtime by implementing the ITemplate
class.
This Gridview displays a list of articles. Each article has a Title,
Content and PubDate.
I am trying to create a Date Header like in a blog, i.e., display the
date on top of every daily posts.
For example:
Wednesday, 25 of April of 2007
Article 3 (PubDate: 25.04.2007 # 20:15)
Article 2 (PubDate: 25.04.2007 # 11:30)
Article 1 (PubDate: 25.04.2007 # 08:40)
Wednesday, 24 of April of 2007
Article 2 (PubDate: 24.04.2007 # 21:32)
Article 1 (PubDate: 24.04.2007 # 15:45)
How can I created the date header as I described?
Thanks,
Miguel
Hello Steve,

My main problem is that I would also need to have paging. I think
Asp.Net 2.0 Repeater does not have paging.
Any idea?

And how can I determine if the Date Header should be added or not?

Thanks,
Miguel
Apr 26 '07 #4
On Apr 25, 10:34 pm, "Bruno Piovan" <brunopiovan AT gmail DOT com
(NOSPAM!)wrote:
Miguel,
you can use the RowDataBound event, and check if the rowtype is Header, then
set the text you want, like:

If e.Row.RowType = DataControlRowType.Header Then
e.Row.Cells(0).Text = Now.ToString
End If

Bruno

"shapper" <mdmo...@gmail.comwrote in message

news:11**********************@t38g2000prd.googlegr oups.com...
Hello,
I have created a GridView on runtime by implementing the ITemplate
class.
This Gridview displays a list of articles. Each article has a Title,
Content and PubDate.
I am trying to create a Date Header like in a blog, i.e., display the
date on top of every daily posts.
For example:
Wednesday, 25 of April of 2007
Article 3 (PubDate: 25.04.2007 # 20:15)
Article 2 (PubDate: 25.04.2007 # 11:30)
Article 1 (PubDate: 25.04.2007 # 08:40)
Wednesday, 24 of April of 2007
Article 2 (PubDate: 24.04.2007 # 21:32)
Article 1 (PubDate: 24.04.2007 # 15:45)
How can I created the date header as I described?
Thanks,
Miguel
Hi Bruno,

Got lost about it. See that in my articles list I will have various
headers. One data header for each date.
Please see the following blog:
http://blogs.publico.pt/artephotographica/

If you scroll down to 12 of April you will see that date header has
more then one post under it.
So each date header is added only when the post is a new article.

Thanks,
Miguel

Apr 26 '07 #5

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

Similar topics

2
1482
by: Smokey Grindle | last post by:
In .NET 1.1 I could have a column bound with date/time fields.. then say the format of it was this {0:MMM d,yyyy h:mm tt} and it would display in this format Jan 1, 2006 2:03 PM however in...
1
2739
by: puja | last post by:
hi all, am using grid view in asp.net 2.0 . My problem is easy but can't get it to work. My grid view id = grdContract and am binding grid view using dataset My dataset returns 5 columns from...
1
3683
by: parez | last post by:
Hi all, I have a storep procedure which returns 5 columns. i want to show only two columsn in the grid view. first column is a link based on some 3 of the columns. i added the following in...
2
4068
by: probashi | last post by:
Hi, Using the SqlDataSource/SelectParameters/ControlParameter one can easily bind a Grid View with a list box (or any other controls), pretty cool, but my list box is multi select. My...
12
4687
by: brwalias | last post by:
Hi, using .net 2 sql server 2005 Here is my situation: I'm passing a variable in the url from a selection on Page A and need to display the results on the Results page be based on that...
0
342
by: =?Utf-8?B?Ym9iYnk=?= | last post by:
I have a Grid View. Here I have a column "Active". I attached this GridView to objectDataSource. In database this field has true or false value.(1 or 0). But in Grid View I want to show that if...
2
1380
by: shahidrasul | last post by:
hi in my project a data grid view in which is show a list of employees which i get from database, i add a even double click on any cell , when i click on any cell, i want to display a form to...
0
2727
by: cadab | last post by:
I have a data grid view, i have specified several columns through the designer that i would like to show on the grid, i have mapped them to the datasource, this works fine, the problem is, my data...
6
2054
by: AnagJohari | last post by:
actually i want to edit the row of an grid view by code behind not using any sql data source. u know that that show edit button property in a grid view when we set this property to true &...
0
7212
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,...
1
7017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7470
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...
0
5604
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,...
1
5026
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...
0
3174
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1524
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 ...
1
751
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
405
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...

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.