GridDateTimeColumn calander properties

2 posts, 0 answers
  1. EmpowerIT
    EmpowerIT avatar
    117 posts
    Member since:
    Jun 2007

    Posted 10 Jun 2009 Link to this post

    Hi
    I am using a GridDateTimeColumn and would like to be able to set the calander properties, namely the ShowRowHeaders property to false.

    I have tried setting it in the ItemCreated & ItemDataBound events of the grid, but to no avail ... The code is below:

    1     <telerik:RadGrid ID="MyRadGrid" runat="server" AllowPaging="True" AllowMultiRowSelection="true" 
    2         AutoGenerateColumns="False" AllowAutomaticDeletes="True" AllowMultiRowEdit="true" 
    3         AllowAutomaticInserts="False" AllowAutomaticUpdates="False" GridLines="None" 
    4         AutoGenerateDeleteColumn="True" AutoGenerateEditColumn="false"
    5         <ClientSettings Selecting-AllowRowSelect="true"
    6         </ClientSettings> 
    7         <MasterTableView DataKeyNames="MyId" EditMode="EditForms" CommandItemDisplay="Top"
    8             <RowIndicatorColumn> 
    9                 <HeaderStyle Width="20px"></HeaderStyle> 
    10             </RowIndicatorColumn> 
    11             <ExpandCollapseColumn> 
    12                 <HeaderStyle Width="20px"></HeaderStyle> 
    13             </ExpandCollapseColumn> 
    14  
    15             <Columns> 
    16                 
    17                 <telerik:GridDateTimeColumn DataField="date" HeaderText="date" UniqueName="date" 
    18                     PickerType="DateTimePicker" > 
    19                      
    20                 </telerik:GridDateTimeColumn> 
    21                  
    22             </Columns> 
    23         </MasterTableView> 
    24         <FilterMenu EnableTheming="True"
    25             <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
    26         </FilterMenu> 
    27     </telerik:RadGrid> 


    1  void MyRadGrid_ItemCreated(object sender, GridItemEventArgs e) 
    2     { 
    3         if (e.Item is GridEditableItem && e.Item.IsInEditMode) 
    4         { 
    5             GridEditableItem item = e.Item as GridEditableItem; 
    6              
    7             RadDateTimePicker date = item["date"].Controls[0] as RadDateTimePicker; 
    8             if (date != null
    9                 date.Calendar.ShowRowHeaders = false
    10         } 
    I can confirm that the above code is excuted, however the changes are not displayed. The radgrid is set to update itself in the radajax manager.


  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 10 Jun 2009 Link to this post

    Hello,

    Try the following code snippet in ItemDataBound event.

    CS:
     
    protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
         if (e.Item is GridEditableItem && e.Item.IsInEditMode)  
            {  
                GridEditableItem item = e.Item as GridEditableItem;              
                RadDateTimePicker date = item["date"].Controls[0] as RadDateTimePicker;  
                if (date != null)  
                    date.SharedCalendar.ShowRowHeaders = false;  
            }  

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top