我正在使用System.Globalization.DateTimeFormatInfo.InvariantInfo来解析日期格式01022013,20130102.我可以解析01022013但我无法解析20130102.
DateTime dt = DateTime.ParseExact(sampleDate, "MMddyyyy", System.Globalization.DateTimeFormatInfo.InvariantInfo);
Run Code Online (Sandbox Code Playgroud)
我怎么能这样做?
我有一个视图,其中我有一个Url.Action链接.当用户点击此链接时,我正在重定向到一个操作方法.当用户点击Url.Action链接时,我需要将viewbag传递给此方法,我需要在重定向的action方法中访问此viewbag值.
在视图中:
<a class="Border left " id="BackBtn"
href="@Url.Action("Search")">
<span>@Labels.BacktoQuesstions</span>
</a>
Run Code Online (Sandbox Code Playgroud)
在控制器中:
public ActionResult Search()
{
//Here I need to access the viewbag value from Url.Action method
}
Run Code Online (Sandbox Code Playgroud)
谢谢你的建议!!