微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在ASP.NET上放置日期格式

如何解决在ASP.NET上放置日期格式

我正在图书馆管理网站上工作。我在ASP.NET中设置日期有些麻烦。

我如何让应用程序用户在创建项目时选择当前的日期格式?

Create.csshtml

   @model LibraryProject.LibraryItem

@{
    ViewBag.Title = "Create";
}

<h2>Create</h2>


    @using (Html.BeginForm()) 
    {
        @Html.AntiForgeryToken()
        
        <div class="form-horizontal">
            <h4>Book</h4>
            <hr />
            @Html.ValidationSummary(true,"",new { @class = "text-danger" })
    
    
            <div class="form-group">
                @Html.LabelFor(model => model.CategoryId,"Category",htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.DropDownList("CategoryId",null,htmlAttributes: new { @class = "form-control" })
                    @Html.ValidationMessageFor(model => model.CategoryId,new { @class = "text-danger" })
                </div>
            </div>
    
            <div class="form-group">
                @Html.LabelFor(model => model.Title,htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.EditorFor(model => model.Title,new { htmlAttributes = new { @class = "form-control" } })
                    @Html.ValidationMessageFor(model => model.Title,new { @class = "text-danger" })
                </div>
            </div>
    
            <div class="form-group">
                @Html.LabelFor(model => model.Author,htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.EditorFor(model => model.Author,new { htmlAttributes = new { @class = "form-control" } })
                    @Html.ValidationMessageFor(model => model.Author,new { @class = "text-danger" })
                </div>
            </div>
    
            <div class="form-group">
                @Html.LabelFor(model => model.Pages,htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.EditorFor(model => model.Pages,new { htmlAttributes = new { @class = "form-control" } })
                    @Html.ValidationMessageFor(model => model.Pages,new { @class = "text-danger" })
                </div>
            </div>
    
           
    
            <div class="form-group">
                @Html.LabelFor(model => model.IsBorrowable,htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    <div class="checkBox">
                        @Html.EditorFor(model => model.IsBorrowable)
                        @Html.ValidationMessageFor(model => model.IsBorrowable,new { @class = "text-danger" })
                    </div>
                </div>
            </div>
    
            <div class="form-group">
                @Html.LabelFor(model => model.Borrower,htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.EditorFor(model => model.Borrower,new { htmlAttributes = new { @class = "form-control" } })
                    @Html.ValidationMessageFor(model => model.Borrower,new { @class = "text-danger" })
                </div>
            </div>
    
            <div class="form-group">
                @Html.LabelFor(model => model.BorrowDate,htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.ValidationMessageFor(model => model.BorrowDate,"The date is created automatically.",new { @class = "text-danger" })
                </div>
            </div>
    
            <div class="form-group">
                @Html.LabelFor(model => model.Type,htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.EditorFor(model => model.Type,new { htmlAttributes = new { @class = "form-control" } })
                    @Html.ValidationMessageFor(model => model.Type,new { @class = "text-danger" })
                </div>
            </div>
    
            <div class="form-group">
                <div class="col-md-offset-2 col-md-10">
                    <input type="submit" value="Create" class="btn btn-default" />
                </div>
            </div>
        </div>
    }
    
    <div>
        @Html.ActionLink("Back to List","Index")
    </div>
    
    @section Scripts {
        @Scripts.Render("~/bundles/jqueryval")
    }

enter image description here

因此您可以在图像上看到,当用户创建一本书时,我想获取借阅日期,这样做的最佳方法是什么?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。