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

range rad date picker

3 Answers 173 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Ashraf
Top achievements
Rank 2
Ashraf asked on 31 Oct 2012, 10:51 AM
hi ,kindly help me . i have two datepickers (start date ,end date )
i want when the user select start date all end dates less than the start date become disabled likes the range filter date in radgrid 

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 01 Nov 2012, 10:43 AM
Hi Ashraf,

Try the following code snippet to achieve your scenario.

ASPX:
<telerik:RadDatePicker ID="startdate" runat="server" AutoPostBack="true" OnSelectedDateChanged="startdate_SelectedDateChanged">
</telerik:RadDatePicker>
<telerik:RadDatePicker ID="enddate" runat="server">
</telerik:RadDatePicker>

C#:
protected void startdate_SelectedDateChanged(object sender, Telerik.Web.UI.Calendar.SelectedDateChangedEventArgs e)
 {
    enddate.MinDate = startdate.SelectedDate.Value;
 }

Hope this helps.

Regards,
Princy.
0
Ashraf
Top achievements
Rank 2
answered on 02 Nov 2012, 02:40 PM
Thanks Princy , I handled it by using shared calender and set min date by client side ,
i have other issue , i have the same (2 date picker start and end date) in rad grid in edit mode each date picker in deferent  column .
my problem is  how to find date picker in client side in rad grid in edit mode by using this way ($find ('<%=rdpenddate.ClientID%>')) to set min date 
or is there a way to pass extra paramater  to client side datepicker function from code behind  for example  
function startdateseelect(sender,args,enddatepicker){
//set min date code 
}
0
Princy
Top achievements
Rank 2
answered on 05 Nov 2012, 06:06 AM
Hi Ashraf,

You can access the RadDatePicker in client side as shown below.

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
  if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
        {
          GridEditFormItem item = (GridEditFormItem)e.Item;
          RadDatePicker pkr = (RadDatePicker)item.FindControl("RadDatePicker1");
          RadGrid1.Controls.Add(new LiteralControl("<script type='text/javascript'>window['pkr'] = '" + pkr.ClientID + "';</script>"));
  }
}

JS:
function OnClientClick()
{
  var pkr = $find(window['pkr']);
}

Hope this helps.

Regards,
Princy.
Tags
Calendar
Asked by
Ashraf
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Ashraf
Top achievements
Rank 2
Share this question
or