Hi
i'm exporting a radgrid and trying to format the date to a culture e.g en-us, en-gb.
i've looked at http://www.telerik.com/help/aspnet-ajax/grid-excelml-export.html
but this only allows me to specify shortdate, general date etc
what i want is to display it in the export as follows
en-us - 8/24/2011
en-gb - 24/8/2011
i have formatted it in the radgrid by setting the culture on the page_load
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(siteCulture);
RadGrid1.Rebind();
as i understand from http://www.telerik.com/community/forums/aspnet-ajax/grid/exportsettings-api.aspx
The export gets the data from the db and not the radgrid, so the format in the db is shown, is that right?
i am using onNeedDataSource to populate my radgrid
my current code for export cell styles is:
how do i format the date as i want based on culture?
also the background colors i'm applying do not get added to the A column in the excel, why is this?
Thanks
Adam
i'm exporting a radgrid and trying to format the date to a culture e.g en-us, en-gb.
i've looked at http://www.telerik.com/help/aspnet-ajax/grid-excelml-export.html
but this only allows me to specify shortdate, general date etc
what i want is to display it in the export as follows
en-us - 8/24/2011
en-gb - 24/8/2011
i have formatted it in the radgrid by setting the culture on the page_load
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(siteCulture);
RadGrid1.Rebind();
as i understand from http://www.telerik.com/community/forums/aspnet-ajax/grid/exportsettings-api.aspx
The export gets the data from the db and not the radgrid, so the format in the db is shown, is that right?
i am using onNeedDataSource to populate my radgrid
my current code for export cell styles is:
protected void RadGrid1_ExcelMLExportRowCreated(object source, GridExportExcelMLRowCreatedArgs e)
{
e.Row.Cells.GetCellByName("ItemCreatedWhen").StyleValue = "dateStyle";
}
protected void RadGrid1_ExcelMLExportStylesCreated(object source, GridExportExcelMLStyleCreatedArgs e)
{
foreach (StyleElement style in e.Styles)
{
switch (style.Id)
{
case "headerStyle":
style.FontStyle.Bold = true;
break;
case "itemStyle":
style.InteriorStyle.Color = System.Drawing.Color.White;
style.InteriorStyle.Pattern = Telerik.Web.UI.GridExcelBuilder.InteriorPatternType.Solid;
break;
case "alternatingItemStyle":
style.InteriorStyle.Color = System.Drawing.Color.LightBlue;
style.InteriorStyle.Pattern = Telerik.Web.UI.GridExcelBuilder.InteriorPatternType.Solid;
break;
}
}
StyleElement myStyle = new StyleElement("dateStyle");
myStyle.NumberFormat.FormatType = NumberFormatType.ShortDate;
myStyle.FontStyle.Bold = true;
e.Styles.Add(myStyle);
}
how do i format the date as i want based on culture?
also the background colors i'm applying do not get added to the A column in the excel, why is this?
Thanks
Adam