473,624 Members | 2,275 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 2265
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.goo glegroups.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 = DataControlRowT ype.Header Then
e.Row.Cells(0). Text = Now.ToString
End If

Bruno

"shapper" <md*****@gmail. comwrote in message
news:11******** **************@ t38g2000prd.goo glegroups.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.netwr ote:
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.goo glegroups.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 = DataControlRowT ype.Header Then
e.Row.Cells(0). Text = Now.ToString
End If

Bruno

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

news:11******** **************@ t38g2000prd.goo glegroups.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
1489
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 .NET 2.0 doing the same thing in the grid view with a date time bound field to a column with the format string as {0:MMM d,yyyy h:mm tt} gives me this
1
2743
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 sql database and I have auto generate columns = true for grdContract grdContract.DataSource = ........dataset returned by a function
1
3689
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 the aspx. <Columns>
2
4077
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 questions is, how can I bind a Grid View Control to a multi select list box (or any multi values controls) Thanks
12
4701
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 variable in the url. I would like that variable to trigger a stored and
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 this field has value 1 in database the value for this column should show "Yes" but if the value of this field is 0 in data base the The GridView should show "No". How can I do that.
2
1390
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 show information of particular employee. when i click on row i get row index of clicked row through this i get employee id from list and show them. but problem is here when i arrange a grid view in ascending or descending order then i click on any...
0
2734
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 source contains lots of columns and some of these i do not want to show on the grid. Is there a property/option where i can just get my specified columns to show, without resorting to removing each column programticly. Thanks, James Coverdale
6
2060
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 & simply connect it to the sql data source we use a update command property in sql data source by doing all this we create a such type of data grid in which edit button is display in every row when u click on edit button then the corresponding row is...
0
8177
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
8681
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
8629
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8341
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8488
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
7170
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
4084
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...
1
2611
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 we have to send another system
1
1793
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.