Hi
I have run into interesting case - Grid shows Aug 2 in view mode and Feb 8 in edit mode.
here is the code that can let you reproduce issue. All 4 columns in the grid will show Aug 2 in view mode, but in Edit mode, only d4 column will show Aug 2, rest will display Feb 8.
on ASPX side:
on server side:
Can you explain what is wrong with 1st 3 columns and is there a fix?
Thanks,
Dmitry
I have run into interesting case - Grid shows Aug 2 in view mode and Feb 8 in edit mode.
here is the code that can let you reproduce issue. All 4 columns in the grid will show Aug 2 in view mode, but in Edit mode, only d4 column will show Aug 2, rest will display Feb 8.
on ASPX side:
<telerik:RadGrid ID="rgGrid1" runat="server" AutoGenerateColumns="false"> <MasterTableView EditMode="EditForms"> <Columns> <telerik:GridEditCommandColumn></telerik:GridEditCommandColumn> <telerik:GridDateTimeColumn UniqueName="d1" PickerType="DateTimePicker" DataField="d1" HeaderText="d1" DataType="System.DateTime" EditDataFormatString="MMM dd HH:mm" DataFormatString="{0:MMM dd HH:mm}" > </telerik:GridDateTimeColumn> <telerik:GridDateTimeColumn UniqueName="d2" DataField="d2" HeaderText="d2" DataType="System.DateTime" EditDataFormatString="MMM dd HH:mm" DataFormatString="{0:MMM dd HH:mm}" > </telerik:GridDateTimeColumn> <telerik:GridDateTimeColumn UniqueName="d3" DataField="d3" HeaderText="d3" DataType="System.DateTime" ColumnEditorID="ed" EditDataFormatString="MMM dd HH:mm" DataFormatString="{0:MMM dd HH:mm}" > </telerik:GridDateTimeColumn> <telerik:GridTemplateColumn UniqueName="d4" HeaderText="d4" DataType="System.DateTime" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="120px" > <ItemTemplate> <asp:Label runat="server" ID="lblLastTicket" Text='<%# Eval("d4", "{0:MMM dd HH:mm}") %>'></asp:Label> </ItemTemplate> <EditItemTemplate> <telerik:RadDateTimePicker runat="server" ID="txtLastTicket" DbSelectedDate='<%#Bind("d4", "{0:MMM dd HH:mm}") %>' Width="150px" DateInput-ReadOnly="true" DateInput-DateFormat="MMM dd HH:mm"></telerik:RadDateTimePicker> </EditItemTemplate> </telerik:GridTemplateColumn> </Columns> </MasterTableView></telerik:RadGrid><telerik:GridDateTimeColumnEditor ID="ed" runat="server" ></telerik:GridDateTimeColumnEditor>on server side:
DateTime dt2 = DateTime.Parse("2011-08-02");
DataTable dttest = new DataTable();dttest.Columns.Add(new DataColumn("d1", typeof(DateTime)));dttest.Columns.Add(new DataColumn("d2", typeof(DateTime)));dttest.Columns.Add(new DataColumn("d3", typeof(DateTime)));dttest.Columns.Add(new DataColumn("d4", typeof(DateTime)));DataRow dr = dttest.NewRow();dr["d1"] = dt2;dr["d2"] = dt2;dr["d3"] = dt2;dr["d4"] = dt2;dttest.Rows.Add(dr);rgGrid1.DataSource = dttest;if (!IsPostBack) rgGrid1.DataBind();Can you explain what is wrong with 1st 3 columns and is there a fix?
Thanks,
Dmitry