Incrementing time in a Datagrid

sureshcd10

Regular
Joined
Dec 25, 2003
Messages
77
Hi all,
I want my dataGrid to display time like the following in an asp.net webform:
Code:
TIME

00:00
00:30
01:00
01:30
02:00
.
.
.
23:00
plz help me how can I do this
Thanking you all
 
Since they are set times, why don't you store them in a database and bind it to a column?
Assuming you are doing a scheduling type function anyways - you will probably save the time somewhere, would that work for you?
Amy

sureshcd10 said:
Hi all,
I want my dataGrid to display time like the following in an asp.net webform:
Code:
TIME

00:00
00:30
01:00
01:30
02:00
.
.
.
23:00
plz help me how can I do this
Thanking you all
 
Thank u for your help.

I solved the problem by using the following piece of code

Code:
  Dim dr As DataRow
        Dim i As Integer
        Dim strdate As DateTime
        strdate = Today()
        tmpUser = New DataTable
 For i = 0 To 47
            dr = tmpUser.NewRow()
            If (i = 0) Then
                dr(0) = "" & Mid(String.Format("{0:u}", strdate), 12, 5)
            Else
                strdate = strdate.AddMinutes(30)
                dr(0) = "" & Mid(String.Format("{0:u}", strdate), 12, 5)
            End If
            tmpUser.Rows.Add(dr)
 Next
 MyGrid.DataSource = tmpUser
         MyGrid.DataBind()
 
Back
Top