日期过滤器gridmvc不工作 [英] Date filter not working in gridmvc

查看:122
本文介绍了日期过滤器gridmvc不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发MVC应用程序。我用gridMvc版本2.0.0.0。当我试图筛选日期,但它不是working.When我试图从日历日期,日期是没有得​​到选择。

I am developing Mvc application. I used gridMvc version 2.0.0.0. when I am trying to filter date but it not working.When i am trying to select date from calender,date is not getting selected.

下面是我的code的看法

below is my code for view

@model IEnumerable<StockWatch.DTO.EmployeeDTO>
@using GridMvc.Html
@using System.Web.UI.WebControls

@{
    ViewBag.Title = "Index";
}
<div class="row-fluid" style="margin-top:30px;margin-bottom:10px;margin-left:0px; margin-right:0px;">
    <div class="listheading span9">
        <div class="span2" style="font-size:22px;margin-right:5px;">
            Employees
        </div> 
    </div>
    <div class="createlink span3" style="text-align:right;margin-left:10px;">
        @Html.ActionLink("+ Add Employee", "Create")
    </div>
</div>

<div class="span12" style="margin-left:0px;margin-right:0px;">
        @Html.Grid(Model).Columns(columns => 
                    {
                        columns.Add(c => c.FirstName).Titled("First Name").SetWidth(400).Sortable(true).Filterable(true);
                        columns.Add(c => c.LastName).Titled("Last Name").SetWidth(900).Sortable(true).Filterable(true);
                        columns.Add(c => c.MobileNo).Titled("Mobile No.").SetWidth(400).Sortable(true).Filterable(true);
                        columns.Add(c => c.Email).Titled("Email").SetWidth(400).Sortable(true).Filterable(true);
                        columns.Add(c => c.LocationName).Titled("Location").SetWidth(800).Sortable(true).Filterable(true);
                        columns.Add(c => c.Designation).Titled("Designation").SetWidth(400).Sortable(true).Filterable(true);
                        columns.Add(c => c.JoiningDate).Titled("Joining<br/>Date").Format("{0:dd-MMM-yy}").SetWidth(400).Sortable(true).Filterable(true);  

</div>

如何做到这一点?
谢谢你在前进。

How to do that? Thank you in advance.

推荐答案

您需要添加脚本和样式吧。

You need to add script and styles for it.

和你的领域数据类型必须是日期时间。

And your field datatype must be Datetime.

脚本和样式Grid.MVC

Scripts and style for Grid.MVC

<link href="@Url.Content("~/Content/Gridmvc.css")" rel="stylesheet" />
<link href="@Url.Content("~/Content/bootstrap.min.css")" rel="stylesheet" />
<script src="@Url.Content("~/Scripts/jquery-1.9.1.min.js")"></script>
<script src="@Url.Content("~/Scripts/gridmvc.min.js")"></script>

脚本和样式Grid.Mvc日期选择器

Scripts and style for Grid.Mvc datepicker

<script src="~/Scripts/bootstrap-datepicker.js"></script>
<link href="~/Content/gridmvc.datepicker.css" rel="stylesheet" />
<link href="~/Content/gridmvc.datepicker.min.css" rel="stylesheet" />

这篇关于日期过滤器gridmvc不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆