RadDatePicker Problem

2 posts, 1 answers
  1. Kyle Jones
    Kyle Jones avatar
    30 posts
    Member since:
    Jul 2009

    Posted 07 Aug 2009 Link to this post

    Hey,

    I am having a problem with a RadDatePicker.  My picker is sitting inside a GridTemplateColumn under the EditItem section.  I am wanting to set the SelectedDate and the MaxDateRange from the codebehind but I cannot figure out how to access the control.  Can you please help me out??


    Thanks,

    Kyle
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 10 Aug 2009 Link to this post

    Hello Kyle,

    Try the following code snippet in order to set the SelectedDate, MinDate and MaxDate properties of RadDatePicker (placed in EditItemTemplate) from code behind.

    ASPX:
     
    <telerik:GridTemplateColumn> 
        <EditItemTemplate> 
            <telerik:RadDatePicker ID="RadDatePicker1" runat="server">  
            </telerik:RadDatePicker>                              
        </EditItemTemplate>                          
    </telerik:GridTemplateColumn> 

    C#:
     
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)  
    {  
        if (e.Item is GridEditFormItem && e.Item.IsInEditMode)  
        {  
            GridEditFormItem item = (GridEditFormItem)e.Item;  
            RadDatePicker DatePicker = (RadDatePicker)item.FindControl("RadDatePicker1");  
            DatePicker.SelectedDate = DateTime.Now.Date;  
            DatePicker.MinDate = Convert.ToDateTime("07/07/2009");  
            DatePicker.MaxDate = Convert.ToDateTime("09/09/2009");  
        }  

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