使用 telerik radGrid - 如何在编辑模式下设置自动生成列的日期格式
使用 VS2008 和 Telerik radGrid 版本 2010.1.519.35
我有大约 50 个使用 Telerik radgrid 的 DNN 模块,我需要以 dd/mm/yy 格式显示日期。在查看模式下可以轻松完成此操作,但当我切换到编辑模式时,这就更加困难了。我可以编写一段代码将显示的日期值重新格式化为 dd/mm/yy,但对于插入,用户必须输入 mm/dd/yy。
IOW,我需要将表单的文化更改为 en-GB 文化。
在我的 DotnetNuke 应用程序中,我对 web.config 进行了更改,但它仍然采用 en-US 格式。
我不确定是否需要在 web.config 级别、页面级别或控件内的列上进行设置。
我为此苦苦挣扎了一个月或更长时间,如有任何帮助,我们将不胜感激,
谢谢马克
·布林 爱尔兰 宝马 R80GS 1987
Using VS2008, and Telerik radGrid version 2010.1.519.35
I have a about 50 DNN modules using telerik radgrid and I need to display my dates in dd/mm/yy format. It is possible to do this easily in view mode, but when I switch to edit mode, it is more of a struggle. I can write a snippit of code to reformat the displayed date values to dd/mm/yy, but for inserts the user must enter mm/dd/yy.
IOW, I need to change the culture of the form to en-GB culture.
In my DotnetNuke App, I have made a change to the web.config, but it still assumes en-US format.
I am not sure whether I need to set this at web.config level, page level or at the column within the control.
I am struggling with this for a month or more and any help would be appriciated,
thanks
Mark Breen
Ireland
BMW R80GS 1987
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
昨天,Christoph Herold 为我解决了我的问题,他是下周 DNN 欧洲日的发言人之一。
正如 bdukes 也建议的那样,简单的解决方案是添加另一种语言。您所要做的就是
1) 进入管理菜单并选择语言
2) 添加语言包
3) 选择 en-GB 作为主要选项,选择 en-US 作为备用选项
4) 将新包设置为默认包。
也就是说,问题已解决。这些包已预先安装,因此我无需购买或安装任何东西,
感谢
Mark Breen
Ireland
BMW R80GS 1987
My problem was solved for me yesterday by Christoph Herold, - one of the speakers at Day of DNN Europe next week.
The simple solution, as bdukes also suggests, is to add another Language. All you have to do is
1) Go to admin menu and select Languages
2) Add Language Pack
3) Select en-GB as the main and en-US as a fall back
4) Set the new pack as the default.
thats is, the problem is fixed. the packs come pre-installed so i did not have to buy or install anything
thanks
Mark Breen
Ireland
BMW R80GS 1987
为了更改应用程序在 DotNetNuke 中运行的区域性,您需要将区域性安装到应用程序中。文化与 DNN 中的语言相当同义词,因此您真正需要做的是通过“管理员”或“主机”菜单下的“语言”页面创建 en-GB 文化。
您应该能够自己创建 en-GB 语言,但您也可以获得免费或付费语言包,其中包括对 DNN 使用的文本的本地化更改(这对您可能重要也可能不重要,因为您'已经是英文了)。您可以在 http://www.DNN 4.9 语言包获取免费的 DNN 4.9 语言包。 dotnetnuke.com/Development/LanguagePacks/tabid/933/Default.aspx,或付费 DNN 5.2.3 语言包 http://www.dnnenglish.com。 (安装旧版本只会影响本地化的最新程度,即有多少新功能未本地化)。
In order to change the culture the application is running as in DotNetNuke, you need to install the culture into the application. Cultures are fairly synonymous with languages in DNN, so what you really need to do it create an en-GB culture via the Languages page under the Admin or Host menu.
You should be able to create the en-GB language yourself, but you can also get a free or paid language pack, which will include localization changes to the text that DNN uses (which may or may not be important to you, since you're already in English). You can get a free DNN 4.9 language pack at http://www.dotnetnuke.com/Development/LanguagePacks/tabid/933/Default.aspx, or paid DNN 5.2.3 language packs at http://www.dnnenglish.com. (Installing an older version should just affect how up-to-date the localization is, i.e. how many new features are not localized).
你不需要改变文化。
您需要做的是更改 ItemDataBound 事件的格式。以下是获取名为“Abstract”的列中的项目并将斜体应用于文本的示例。对于您的情况,我不确定您如何处理日期的数据输入......但在 EditTemplate 中我会放置一个日期选择器控件,以便您可以完全控制输入的日期。这样,用户选择日期,单击更新,然后以您需要执行的 DD/MM/YY 格式显示日期。日期选择器控件还将以您需要的格式显示日期。我碰巧喜欢 Rick Strahl 的 jQuery 日期选择器 作为我的网络应用程序日期输入字段。
You don't need to change the culture.
What you need to do is change the format on the ItemDataBound event. Here is a sample of getting an item in a column named "Abstract" and applying italics to the text. For your situation, I'm not sure how you are handling data entry of a date.... but in the EditTemplate I would put a date picker control so you have complete control of the date entered. That way, the user selects the date, clicks update, and then you present the date in the DD/MM/YY format that you are required to do. The date picker control will also display the date in the format you need. I happen to like Rick Strahl's jQuery date picker for my web app date entry fields.