Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. saparating Range of dates (urgent one pls)...

saparating Range of dates (urgent one pls)...

Scheduled Pinned Locked Moved ASP.NET
helptutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    peter rankel
    wrote on last edited by
    #1

    hi all, In my table i have two columns named FromDate and ToDate. I have to find the each and every date in that range and display them in a datagrid. Let us take from date: 06/10/2006 (mm/dd/yy) To Date: 06/15/2006 output should be like this( in datagrid) check box 06/10/2006 check box 06/11/2006 check box 06/12/2006 check box 06/13/2006 .... check box 06/15/2006 can anybody help me how to do it Thanx in advance.. your peter

    M 1 Reply Last reply
    0
    • P peter rankel

      hi all, In my table i have two columns named FromDate and ToDate. I have to find the each and every date in that range and display them in a datagrid. Let us take from date: 06/10/2006 (mm/dd/yy) To Date: 06/15/2006 output should be like this( in datagrid) check box 06/10/2006 check box 06/11/2006 check box 06/12/2006 check box 06/13/2006 .... check box 06/15/2006 can anybody help me how to do it Thanx in advance.. your peter

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      You simply read the from, to date values from the two columns in the table to the variables, then build a custom date list and bind it to the datagrid control. The sample code looks something like:

      DateTime from = ...;
      DateTime to = ...;

      List<DateTime> list = new List<DateTime>();
      for(DateTime date = from; date < to; date=date.AddDays(1))
      {
      list.Add(date);
      }

      gridDate.DataSource = list;
      gridDate.DataBind();

      In case you use the ASP.NET 1.1, you can replace the generic List class with the ArrayList or a custom DateTime collection object.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups