真的,我的问题很简单,但我不知道如何解决它。 我有一个ActionResult方法,返回View并采取datetime属性,所以我发送这样的ActionLink datetime属性
@Html.ActionLink("ForignSell", "ForignSell", "Reports", new {Start =@ImpDate.DateConfig},null)ImpDate.DateConfig是我在本地模式下运行时发送给Action的datetime与此格式绑定的datetime dd/MM/YYY没有问题,直到现在我在IIS中发布问题时出现了这个格式的datetime MM/DD/YYY ,这对我来说会产生问题,任何人都知道它为什么以不同的方式绑定?
really my problem is simple but i don't know how to solve it. i have an ActionResult method that return View and take datetime attribute so i send datetime attribute in ActionLink like this
@Html.ActionLink("ForignSell", "ForignSell", "Reports", new {Start =@ImpDate.DateConfig},null)the ImpDate.DateConfig is the date that i sent to Action when i run in local mode the datetime binded with this format dd/MM/YYY there is no problem till now the problem comes when i publish it in IIS the datetime binded with this format MM/DD/YYY and this make problem to me can any one know why it binded in a different way ?
最满意答案
将日期对象转换为您想要的字符串格式:
@Html.ActionLink("ForignSell", "ForignSell", "Reports", new {Start = @ImpDate.DateConfig.ToString("dd/MM/yyy")}, null)ActionLink助手将自动对路径数据进行url编码。
Convert the date object to string format you want:
@Html.ActionLink("ForignSell", "ForignSell", "Reports", new {Start = @ImpDate.DateConfig.ToString("dd/MM/yyy")}, null)The ActionLink helper will be automatically url encode the route data.
更多推荐
发布评论