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

code not displaying as predicted

1 Answer 12 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 21 Nov 2013, 01:00 AM
Firstly with the datepicker just in edit template I wasnt seeing it at all, secondly the formatting of date MMM/yyy isnt showing?

   
<telerik:RadGridView.Columns>
        <telerik:GridViewDataColumn Header="Lot Number" DataMemberBinding="{Binding LotNumber}" />
        <telerik:GridViewDataColumn Header="Expiry Date" DataMemberBinding="{Binding ExpiryDate}" DataFormatString="{} {0: MMM/yyyy}">
            <telerik:GridViewDataColumn.CellTemplate>
                <DataTemplate>
                    <telerik:RadDatePicker x:Name="datePicker" DateTimeWatermarkContent="Select a date" SelectedValue="{Binding ExpiryDate, Mode=OneWay}"  DateSelectionMode="Month"/>
                </DataTemplate>
            </telerik:GridViewDataColumn.CellTemplate>
            <telerik:GridViewDataColumn.CellEditTemplate>
                <DataTemplate>
                    <telerik:RadDatePicker x:Name="datePickerEdit" DateTimeWatermarkContent="Select a date" SelectedValue="{Binding ExpiryDate, Mode=TwoWay}" DateSelectionMode="Month"  />
                </DataTemplate>
            </telerik:GridViewDataColumn.CellEditTemplate>
        </telerik:GridViewDataColumn>
         
    </telerik:RadGridView.Columns>
</telerik:RadGridView>

1 Answer, 1 is accepted

Sort by
0
Yoan
Telerik team
answered on 25 Nov 2013, 03:04 PM
Hello,

As I understand you have define a DatePicker in GridViewColumn's CellTemplate. In this way RadGridView will not enter in edit mode, since the datepicker handles the mouse/keyboard events. You can try to define a CellEditTemplate only:
<telerik:GridViewDataColumn Header="Expiry Date" DataMemberBinding="{Binding ExpiryDate}" DataFormatString="{} {0: MMM/yyyy}">
             
            <telerik:GridViewDataColumn.CellEditTemplate>
                <DataTemplate>
                    <telerik:RadDatePicker x:Name="datePickerEdit" DateTimeWatermarkContent="Select a date" SelectedValue="{Binding ExpiryDate, Mode=TwoWay}" DateSelectionMode="Month"  />
                </DataTemplate>
            </telerik:GridViewDataColumn.CellEditTemplate>
        </telerik:GridViewDataColumn>
In this way you will be able to use the "datePickerEdit" control.

I would suggest you to check this article, where you can find more information about CellTemplate and CellEditTemplate.

Regards,
Yoan
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
Michael
Top achievements
Rank 1
Answers by
Yoan
Telerik team
Share this question
or