This is a migrated thread and some comments may be shown as answers.

it shows this formate" MMM-dd-yyyy h:mm tt" in radgrid

1 Answer 91 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kannadasan
Top achievements
Rank 1
Kannadasan asked on 14 Jul 2010, 08:48 AM
 Dear Team,
I am Using GridDateTimeColumn in rad grid.i want to dateformate on click datepicker  it shows like  this formate" MMM-dd-yyyy h:mm tt"
but i can't do that..Please give a solution.
aspx Code.
<telerik:GridDateTimeColumn SortExpression="actiondate" PickerType="DatePicker" HeaderText="Activity Date"  DataType="System.DateTime"
                                                                           DataFormatString="{0:MMM-dd-yyyy h:mm tt}" DataField="actiondate" UniqueName="actiondate">
                                                                        </telerik:GridDateTimeColumn>

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 14 Jul 2010, 12:17 PM
Hello Kannadasan,

I guess you want to format the SelectedDate shown in RadDatePicker when the grid in edit mode. If so, the following code will help you to achieve this.

C#:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
        {
            GridEditFormItem edititem = (GridEditFormItem)e.Item;
            RadDateTimePicker pick = (RadDateTimePicker)edititem["actiondate"].Controls[0];
            pick.DateInput.DisplayDateFormat = "MMM-dd-yyyy h:mm tt";
        }
    }

Thanks,
Princy.
Tags
Grid
Asked by
Kannadasan
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or