Asp.Net gridview filled row with week date

Posted by Amrendra_Cs under ASP.NET on 3/7/2015 | Points: 10 | Views : 438 | Status : [Member] | Replies : 1
I have a Gridview with three columns as
Date      Hour      Description

rows corresponding to them are in form of textbox.

Initially when page is loaded, Date column should be filled with date of currents week like this:
Date            Hour           Description

01-03-2015 ----- ----

02-03-2015 ----- -----



07-03-2015 ----- -----

The hour and description field should be filled by User. There is next button, when user clicks on that then the grid should refresh and the Date Column should be filled with Dates of Next week starting from Sunday. How this can be achieved?


Posted by: Jitendrasoft09 on: 3/7/2015 [Member] [MVP] Starter | Points: 25


You can achieve your requirement with paging concept in gridview. Please refer below link for more details and understand to go ahead to meet your requirement.

Add below something code to take starting week from Sunday.

dt.AddDays(1 - (dt.DayOfWeek == DayOfWeek.Sunday ? 7 : (int)dt.DayOfWeek));

Jitendra Kumar
If my post helps you, plz mark as an answer.

Amrendra_Cs, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response