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

Disable Previous Date in DateTimePicker inside a Grid

1 Answer 186 Views
Grid
This is a migrated thread and some comments may be shown as answers.
VS
Top achievements
Rank 1
VS asked on 05 Sep 2008, 09:06 AM

Hi,

I have a RadGrid with GridDateTimeColumn as below.

<rad:GridDateTimeColumn DataField="EndDate" UniqueName="EndDate" EditFormColumnIndex="0" DataFormatString="{0:d}" meta:resourcekey="GridTemplateColumnResource2">
                    <HeaderStyle Font-Bold="true" />
                </rad:GridDateTimeColumn>   

How can i make the user not to select a date which is behind todays date from the DatePicker or calendar?
The user should not be allowed to insert manually or type in the date also into the dateinput.

Ie: Today is 05/09/2008. And i dont want the user to select any date on or before 04/09/2009.

Can those dates be disabled in the calendar?

Regards

Sujith

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 05 Sep 2008, 09:20 AM
Hi Sujith,

Try the following approach and see whether it is helpful.

ASPX:
 <telerik:GridDateTimeColumn UniqueName="DateCol" DataField="Date"    HeaderText="DateCol" ></telerik:GridDateTimeColumn> 
                   

CS:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if ((e.Item is GridEditableItem)&&(e.Item.IsInEditMode)) 
        { 
            GridEditableItem edititem = (GridEditableItem)e.Item; 
            RadDatePicker datpkr = (RadDatePicker)edititem["DateCol"].Controls[0]; 
            datpkr.MinDate = DateTime.Today; 
             
        } 
   } 


Thanks
Shinu.
Tags
Grid
Asked by
VS
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or