This question is locked. New answers and comments are not allowed.
Hi,
I have a date picker in the gridview and I need to format the date in that. I am able to do it perfectly. But the problem is that the format gets applied only when tab off takes place. The format which I have specified does not apply when I select the date.
In order to achieve this I have done a work around as
<telerik:GridViewDataColumn DataMemberBinding="{Binding Established}"
Header="Est."
DataFormatString="{}{0:M-dd-yyyy}" UniqueName="Unique1"
/>
private void pre_edit(object sender, GridViewPreparingCellForEditEventArgs e)
{
if (e.EditingElement != null && e.EditingElement is Telerik.Windows.Controls.RadDatePicker)
{
if (e.Column.UniqueName.Equals("Unique1", StringComparison.InvariantCultureIgnoreCase))
{
RadDateTimePicker objRadDateTimePicker = e.EditingElement as Telerik.Windows.Controls.RadDatePicker;
objRadDateTimePicker.Culture = new CultureInfo("en-US")
{
DateTimeFormat = new DateTimeFormatInfo
{
ShortDatePattern = "M-dd-yyyy"
}
};
}
}
}
Is there any other way of doing the same? Please help
Regards,
Raghul
I have a date picker in the gridview and I need to format the date in that. I am able to do it perfectly. But the problem is that the format gets applied only when tab off takes place. The format which I have specified does not apply when I select the date.
In order to achieve this I have done a work around as
<telerik:GridViewDataColumn DataMemberBinding="{Binding Established}"
Header="Est."
DataFormatString="{}{0:M-dd-yyyy}" UniqueName="Unique1"
/>
private void pre_edit(object sender, GridViewPreparingCellForEditEventArgs e)
{
if (e.EditingElement != null && e.EditingElement is Telerik.Windows.Controls.RadDatePicker)
{
if (e.Column.UniqueName.Equals("Unique1", StringComparison.InvariantCultureIgnoreCase))
{
RadDateTimePicker objRadDateTimePicker = e.EditingElement as Telerik.Windows.Controls.RadDatePicker;
objRadDateTimePicker.Culture = new CultureInfo("en-US")
{
DateTimeFormat = new DateTimeFormatInfo
{
ShortDatePattern = "M-dd-yyyy"
}
};
}
}
}
Is there any other way of doing the same? Please help
Regards,
Raghul