Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi all,

I want my dataGrid to display time like the following in an asp.net webform:

TIME

00:00
00:30
01:00
01:30
02:00
.
.
.
23:00

plz help me how can I do this

Thanking you all

ima
Posted

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

 

Hi all,

I want my dataGrid to display time like the following in an asp.net webform:

TIME

00:00
00:30
01:00
01:30
02:00
.
.
.
23:00

plz help me how can I do this

Thanking you all

  • 2 weeks later...
Posted

Thank u for your help.

 

I solved the problem by using the following piece of 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()

ima

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...