I'm dynamically building html table from c# code. Here is a portion of my code:
listHTML.Append("<td onClick='GoToHourlyReport("
+ Convert.ToDateTime(dr["IntervalStartTime"]).ToString("yyyy-MM-dd")
+ ","
+ deptId
+ ");' align='center' valign='middle' class='graph_red_grid_text'>"
+ Convert.ToDateTime(dr["IntervalStartTime"]).ToString("yyyy-MM-dd hh:mm:ss")
+ "</td>"
);
On onclick of the td I'm trying to pass a date to a JavaScript function.
onClick='GoToHourlyReport("
+ Convert.ToDateTime(dr["IntervalStartTime"]).ToString("yyyy-MM-dd")
+ ","
+ deptId
+ ");'
But when I pass a date like 2012-10-01, I get a value 1999 inside JavaScript function all the time.
Can any one throw some light about what I'm doing wrong?
Here is the js function
function GoToHourlyReport(date, deptId) {
window.location.href = "CallAverageHourlyReport_BW.aspx?Date=" + date + "&Queue=" + deptId;
}