在中继器中减去评估值
如何在中继器中减去 2 个日期时间? 我想减去 2 个 requestDates 并写入 waitingTime。
<td>
<%#Eval("requestDates")%>
</td>
<td>
<%#Eval("waitingTime")%>
</td>
I wanna get like 1 week 4 days 18 hours 47 minutes:>
ID Request_Dates Waiting_Time
1 18.01.2012 09:54:38 6 days 20 hours 37 mins 13 sec
2 11.01.2012 13:17:25 19 hours 18 mins 47 sec
... .... ....
如您所见,等待时间 = (id 1 request_dates) - (id 2 request_dates) 谢谢。
How can i substract 2 datetime in repeater?
I want to substract 2 requestDates and write to waitingTime.
<td>
<%#Eval("requestDates")%>
</td>
<td>
<%#Eval("waitingTime")%>
</td>
I wanna get like 1 week 4 days 18 hours 47 minutes:>
ID Request_Dates Waiting_Time
1 18.01.2012 09:54:38 6 days 20 hours 37 mins 13 sec
2 11.01.2012 13:17:25 19 hours 18 mins 47 sec
... .... ....
as you see waiting time = (id 1 request_dates) - (id 2 request_dates)
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一个解决方案
您可以创建一个方法并在 html 代码中调用它,如下所示:
在 cs 中:
仅考虑必须在 html 和 cs 中转换变量。
另一种解决方案
我将用 Literals 替换 Eval,添加 ItemDataBound 事件,并在方法中找到控件并分配值,在这里我可以从“e.Item”对象获取值并轻松减去它。
例如:
ONE SOLUTION
You can create a method and call it in your html code, in this way:
in the cs:
Only take into account that you have to cast the variables in the html and cs.
ANOTHER SOLUTION
I would replace the Eval with Literals, add an ItemDataBound event and in the method I would find the controls and assign the values, here I can get the values from the "e.Item" object and substract it easily.
For example: