hello,
i have this code to show days hours min and second betwen two days it works fine on page with single record.
but inside listview with many records its keep on refresh whole page and does not do partial postback so time can run i want timer inside my listview with each record
public string CalculateTimeDifference(DateTime startDate, DateTime endDate)
{
int mins = 0; int secs = 0; int days = 0; int hours = 0;
string final = string.Empty;
if (endDate > startDate)
{
days = (endDate - startDate).Days;
hours = (endDate - startDate).Hours;
mins = (endDate - startDate).Minutes;
secs = (endDate - startDate).Seconds;
final = string.Format("{0} days {1} : {2} : {3} ", days.ToString(), hours.ToString(), mins.ToString().PadLeft(2, '0'), secs.ToString().PadLeft(2, '0'));
}
else
{
final = "Expired";
}
return final;
}
<asp:UpdatePanel runat="server">
<ContentTemplate>
Remaining Time
<asp:Label ID="lblTime" Text="" runat="server" CssClass="r-time text-danger" Visible="true" />
<asp:Timer ID="timer" runat="server" Interval="100">
</asp:Timer>
</ContentTemplate>
</asp:UpdatePanel>