简体   繁体   中英

Using telerik radGrid - how to set the Date format for autogenerated column in edit mode

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

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

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, ie how many new features are not localized).

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.

protected  void gridMyItems_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        ((GridDataItem)e.Item)["Abstract"].Font.Italic = true;
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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