Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
i have tow date picker as follows.
 

Datepicker1 DAtepicker2
when i choose datepicker1 8th day as monday in the datepicker 2 13th day saturday automically display in the datepicker2 no problem.
 
i want the output as
 
that 8th to 13th date will be diplayed in the row wise as follows.when i click the button.
 
what date i choose in the datepicker1 add 5 days and display that date to the datepicker2.when i click the load button that date to be displayed in the row wise in the date grid.
output as follows
 
  DAte SS      GS     VR    CKK    CNN    RV   MS    TSS    CM
 
   8   1
  
   8   2
 
   8   3
  
   9   1
 
   9   2
 
   9   3
 
   10  1
 
   10  2
 
   10  3
 
   11  1
 
   11  2
 
   11  3
 
   12  1
 
   12  2
 
   12  3
 
   13  1
 
   13  2
 
   13  3
 
for that output how to write the code using csharp in windows application.
 
[edit]Code block added - OriginalGriff[/edit]
Posted 6-Jan-13 2:48am
Edited 6-Jan-13 3:28am
v2
Comments
Sandeep Mewara at 6-Jan-13 8:21am
   
OK, and where did you got stuck?
Plyswthsqurles at 6-Jan-13 16:52pm
   
Is this tied to a database? Need to know so can write query as well for this.
 
All you should need to do is create a method that loads the data grid, passes in the two dates and then your sql will have a BETWEEN clause that defines the Date between date picker 1 and date picker 2.
 
If you provide answer i can write snippet.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You can try something like this. This is just a sample code for your thought you can modify this code based on your need.
private void UpdateGrid(DateTime time, int noOfDays)
{
  for (int i = 1; i <= noOfDays; i++)
  {
     DateTime newDate = time.AddDays(i);
 
     for (int newIndex = 0; newIndex < 3; newIndex++)
     {
       DataGridViewRow row = new DataGridViewRow();
 
       row.Cells[0].Value = newDate.ToShortDateString();
       row.Cells[1].Value = newIndex;
 
       this.dataGridView1.Rows.Add(row);
                  
     }
   }
}
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 335
1 OriginalGriff 250
2 Kornfeld Eliyahu Peter 130
3 DamithSL 120
4 Peter Leow 95
0 OriginalGriff 7,355
1 DamithSL 5,199
2 Sergey Alexandrovich Kryukov 4,942
3 Maciej Los 4,906
4 Kornfeld Eliyahu Peter 4,514


Advertise | Privacy | Mobile
Web01 | 2.8.141223.1 | Last Updated 7 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100