1

I need to show inside a repeater the remaining time for a sale object to end, which has DateTime ends property.

Based on https://stackoverflow.com/a/4386305/8383866 I tried to make it work but I'm getting:

) expected.

But I'm sure there is no parenthesis missing.

Ends in: <%#string.Format("{0:hh\\:mm\\:ss}", (TimeSpan)(DateTime.Now - (DateTime)Eval("finaliza")));%>
Barri
  • 33
  • 4
  • Try changing code like: `<%#string.Format("{0:hh\\:mm\\:ss}", DateTime.Now.Subtract(DateTime.Parse(Eval("finaliza"))));%> ` – Mohsin Mehmood Nov 23 '18 at 21:02
  • Thanks but same message error shown, I think I'm going to add that TimeSpan on the object itself and then simply bind it on the repeater. – Barri Nov 26 '18 at 14:02

1 Answers1

0

I think you should convert Eval("finaliza") to DateTime with the Convert.ToDateTime method.

Like this

<%#string.Format("{0:hh\\:mm\\:ss}", (TimeSpan)(DateTime.Now - Convert.ToDateTime(Eval("finaliza"))));%>
Anders Revsgaard
  • 3,636
  • 1
  • 9
  • 25
  • Thanks but same message error shown, I think I'm going to add that TimeSpan on the object itself and then simply bind it on the repeater. – Barri Nov 26 '18 at 14:02