troubleshooting Question

Timer countdown sql, asp.net c#

Avatar of bside2011
bside2011 asked on
C#ASP.NETJavaScript
14 Comments1 Solution1592 ViewsLast Modified:
i have the next javascript code at my try.aspx file:
<input type="hidden" id="auctionEndDate" value="<%=TargetDate%>"> 
<script language="JavaScript"> 
     
 
    TargetDate = "document.forms[0].TargetDate.value"; 
    /*this is a property in code behind*/BackColor = "palegreen"; 
    ForeColor = "navy"; 
    CountActive = true; 
    CountStepper = -1; 
    LeadingZero = true; 
    DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds."; 
    FinishMessage = "the auction end" 
    </script> 
    <script language="JavaScript" src="http://scripts.hashemian.com/js/countdown.js"></script> 
    </script>

Open in new window


code behind:
public string TargetDate () 
{    
    String tDate = "";  
    DataTable dataTable = new DataTable();  
    using (SqlConnection connection = new SqlConnection("Server=localhost;Database=Timer;Trusted_Connection=True"))  
    using (SqlCommand command = connection.CreateCommand())    
    {        
        command.CommandText = "select * from endTime";      
        connection.Open();       
        SqlDataReader reader = command.ExecuteReader();     
        dataTable.Load(reader);     
        tDate = dataTable.Rows[0][0].ToString(); // Expecting the first row and first column 
    } 
    return tDate; 
}

Open in new window


but i got that error:
CS1502: The best overloaded method match for 'System.IO.TextWriter.Write(char)' has some invalid arguments

for the line:
<input type="hidden" id="auctionEndDate" value="<%=TargetDate%>">

what i'm trying to do is to build timer countdown for item, and the endtime coming from sql database. maybe all the way is wrong, i'll be glad to get others way to do that, or fix the error's on the code that i post here.
ASKER CERTIFIED SOLUTION
gavsmith

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 14 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 14 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros