By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,105 Members | 1,551 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,105 IT Pros & Developers. It's quick & easy.

Grid View: How to show a date header?

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.