简体   繁体   English

如何在编辑模式下使用Telerik在ASP.NET MVC2中显示数据类型的数据选择器

[英]How to show datapicker for datatype in asp.net MVC2 using telerik in edit mode

I have an MVC application and using telerik grid for performing the listing,add,edit operation.I am using popup mode for edit/add .I want to show the datepicker for date datatype in the edit and add operation. 我有一个MVC应用程序,并使用telerik网格执行列表,添加,编辑操作。我正在使用弹出模式进行编辑/添加。我想在编辑和添加操作中显示日期数据类型的datepicker。

I have created a partial view for the datepicker using telerik as: 我已经使用telerik为datepicker创建了部分视图:

<%@ Control Language="C#"
            Inherits="System.Web.Mvc.ViewUserControl<System.DateTime?>" %>
<%= Html.Telerik().DatePicker()
        .Name(ViewData.TemplateInfo.GetFullHtmlFieldName(string.Empty))
        .HtmlAttributes(new {
            id = ViewData.TemplateInfo.GetFullHtmlFieldId(string.Empty) +
                 DateTime.Now.Millisecond.ToString()
        })
        .Value(Model > DateTime.MinValue ? Model : DateTime.Today)
%>

and using UIHint added referred in model class but it is giving error: The string was not recognized as a valid DateTime. There is an unknown word starting at index 0. 并使用模型类中引用的UIHint添加,但出现错误: The string was not recognized as a valid DateTime. There is an unknown word starting at index 0. The string was not recognized as a valid DateTime. There is an unknown word starting at index 0.

So how can i show the datepicker while performing the add/edit operation using telerik. 因此,在使用telerik执行添加/编辑操作时,如何显示日期选择器。

If there is any other way to show the datepicker then also it is ok. 如果还有其他方式可以显示日期选择器,那么也可以。

Thanks in advance 提前致谢

supriya 苏普里亚

您收到的错误指示所传递的字符串不是有效的DateTime(无法解析)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM