range rad date picker

4 posts, 0 answers
  1. Ashraf
    Ashraf avatar
    40 posts
    Member since:
    Aug 2012

    Posted 31 Oct 2012 Link to this post

    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 
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 01 Nov 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ashraf
    Ashraf avatar
    40 posts
    Member since:
    Aug 2012

    Posted 02 Nov 2012 Link to this post

    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 
    }
  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 05 Nov 2012 Link to this post

    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.
Back to Top