小编kri*_*ieg的帖子

BundleConfig.cs没有引用任何东西?

对于初学者,我要求你们所有人都忍受我,因为我对ASP和C#总体上并不熟悉,而且我可能没有像我希望的那样塑造大多数概念.

我在BundleConfig.cs上遇到了一些问题.显然,它试图引用的每个模块都不起作用,或者找不到它?

这是我得到的BundleConfig:

using System.Web;
using System.Web.Optimization;

namespace WebApplication
{
    public class BundleConfig
    {
        // For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725
        public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                        "~/Scripts/jquery-{version}.js"));

            bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
                        "~/Scripts/jquery-ui-{version}.js"));

            bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                        "~/Scripts/jquery.validate*"));

            // Use the development version of Modernizr to develop with and learn from. Then, when you're
            // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
            bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                        "~/Scripts/modernizr-*"));

            bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css"));

            bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
                        "~/Content/themes/base/jquery.ui.core.css",
                        "~/Content/themes/base/jquery.ui.resizable.css",
                        "~/Content/themes/base/jquery.ui.selectable.css", …
Run Code Online (Sandbox Code Playgroud)

c# asp.net asp.net-mvc razor bundling-and-minification

2
推荐指数
1
解决办法
1405
查看次数

将 DataGridView 单元格值转换为日期时间

我一直在寻找这个答案一段时间:

我有一个 datagridview,它有一个带有日期的单元格,我需要将该单元格中的值设为一个 DateTime 值,该值可以与我的 DateTimePicker 一起使用

到目前为止,我已经这样做了,但它不起作用,它给了我一个 System.FormatException(显然它无法将字符串识别为 DateTime,这听起来是对的)

这是有问题的代码:

int index = ReservationDataGridView.SelectedRows[0].Index;
string date = ReservationDataGridView[0, 1].Value.ToString();
DateTime test = DateTime.ParseExact(date, "dd/MM/yyyy - hh:mm tt", System.Globalization.CultureInfo.InvariantCulture);

MessageBox.Show(test.ToString()
Run Code Online (Sandbox Code Playgroud)

这是我的 DateTimePicker 的格式:

ReservationDateTimePicker.Format = DateTimePickerFormat.Custom;
ReservationDateTimePicker.CustomFormat = "dd/MM/yyyy - hh:mm tt";
Run Code Online (Sandbox Code Playgroud)

这是日期在 DataGridView 中的外观:

数据网格视图

关于如何将 DataGridView 的 Date 值转换为适合具有该格式的 DateTimePicker 的 DateTime 的任何想法?

c# datetime datagridview datetimepicker winforms

1
推荐指数
1
解决办法
2万
查看次数