Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 12th, 2006, 11:00 AM
Friend of Wrox
 
Join Date: May 2006
Location: Northampton, United Kingdom.
Posts: 107
Thanks: 1
Thanked 8 Times in 7 Posts
Default Gridview, Eval and Current Time

Please help me, I have a mental block on this one.

I have a field in a table identifying the difference for each country between their local time and GMT.

I would like to display in a gridview templated control the current time plus the adjustment for GMT difference to show the current local time.

Can anyone help?


__________________
Try our latest project www.nobanx.com Currency Exchange for members
  #2 (permalink)  
Old September 15th, 2006, 07:16 AM
Authorized User
 
Join Date: Sep 2006
Location: Bangalore, Karnataka, India.
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

As per your requirement as I tried to understand, you have the difference from each country against their local time and GMT already in the table right. So you could try and achieve the same using an SQL query, by adding/substracting the time as per the location.



Vincent Thomas
Bangalore
  #3 (permalink)  
Old September 20th, 2006, 05:50 AM
Friend of Wrox
 
Join Date: May 2006
Location: Northampton, United Kingdom.
Posts: 107
Thanks: 1
Thanked 8 Times in 7 Posts
Default

I'm re-visiting this an have ended up with the following

In the Gridview I have:

<asp:TemplateField HeaderText="Local" SortExpression="BranchGMT">
  <ItemTemplate>
     <asp:Label ID="Label1" runat="server" Text='<%# Eval("BranchGMT", LocalTime("BranchGMT")) %>'></asp:Label>
  </ItemTemplate>
</asp:TemplateField>


I have created a function


    Protected Function LocalTime(ByVal GMTDiff As String) As String
        Dim CurrentTime As Date = Now()
        Dim LT As Date
        Dim GMT As Integer
        GMT = CInt(GMTDiff)
        LT = CurrentTime.AddHours(GMT)
        Return LT
    End Function


When I run this it doesn't send the value of the BranchGMT field to GMTDiff (it goes across as "BranchGMT" and not the value).

Can anyone let me know what I need to do to send the correct value to the function please?

Thanks


  #4 (permalink)  
Old September 20th, 2006, 06:06 AM
Friend of Wrox
 
Join Date: May 2006
Location: Northampton, United Kingdom.
Posts: 107
Thanks: 1
Thanked 8 Times in 7 Posts
Default

It works now just by using:

<asp:Label ID="Label1" runat="server" Text='<%# Eval("BranchGMT", LocalTime(Container.DataItem("BranchGMT"))) %>'></asp:Label>

instead of
<asp:Label ID="Label1" runat="server" Text='<%# Eval("BranchGMT", LocalTime("BranchGMT")) %>'></asp:Label>

:D

Mental block is now cleared, I'm just waiting for the hair to grow back now!



 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
get the current system data and time arunprasadlv XSLT 6 May 7th, 2008 07:43 AM
Current Date and Time in XSLT devMc XSLT 6 October 21st, 2007 04:49 AM
getting current date and time in xslt 1.0 ashyabhi_hp XSLT 1 September 24th, 2007 03:17 AM
Check to See if Current Time is between hours mvollmer Classic ASP Professional 5 July 28th, 2004 07:49 PM
sql - comparing current time suzila VB.NET 2002/2003 Basics 7 May 14th, 2004 12:05 AM



All times are GMT -4. The time now is 01:48 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.