Change End Date as Start Date gets changed, Calendar Control

11 posts, 0 answers
  1. Falgun
    Falgun avatar
    8 posts
    Member since:
    Sep 2008

    Posted 24 Sep 2008 Link to this post

    Hi, I just started using Rad Calendar control...$0$0$0$0Now, I have got a requirement..$0$0-> I have two calendar controls on my page... "Start Date", "End Date" inside my UserControl$0$0-> I already tried as mentioned in this article, http://demos.telerik.com/aspnet/Calendar/Examples/DatePicker/ClientSideEvents/DefaultCS.aspx, where i tried to get Javascript Object for the calendar control by writing var objMyControl  = <% = MyRadPicker.ClientID %>; (this is what they have said in the tutorial; AND I REALLY DOUBT THAT IF ANYTHING LIKE THIS CAN WORK ATALL!!!! , If I see my code behind, I see the line rendered as, var objMyControl=ctrl001_MySearchControl_RadControl, and I get Javascript exception that ctrl001_MySearchControl_RadControl is undefined)$0$0-> If also tried, var objMyControl = document.GetElementById("<%=MyRadPicker.ClientID%>"), but that was returning just "HTMLInput Control" and not the actual object...$0$0-> For me, this is very basic and primary functionality, which everybody needs... and I think, it should be defenetly have been addressed....$0$0-> Appreciate your help$0
  2. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 26 Sep 2008 Link to this post

    Hello Falgun,

    Could you please elaborate more on your scenario and clarify which RadCalendar are you using - RadCalendar for ASP.NET or RadCalendar for ASP.NET AJAX?

    Please find more about the client-side API of RadCalendar for ASP.NET AJAX:
    http://demos.telerik.com/aspnet/prometheus/Calendar/Examples/DatePicker/ClientSideEvents/DefaultCS.aspx
    http://demos.telerik.com/aspnet/prometheus/Calendar/Examples/DatePicker/ClientAPI/DefaultCS.aspx
    http://demos.telerik.com/aspnet/prometheus/Calendar/Examples/Programming/ClientSideAPI/DefaultCS.aspx
    http://www.telerik.com/help/aspnet-ajax/calendar_clientsideraddatepicker.html
    http://www.telerik.com/help/aspnet-ajax/calendar_clientsideradcalendar.html

    Let us know if we can help you further.

    Regards,
    Iana
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Falgun
    Falgun avatar
    8 posts
    Member since:
    Sep 2008

    Posted 26 Sep 2008 Link to this post

    Hello Iana,$0thanks for ur thaughts... let me reveal more detail about the problem..$0$0$0$0$0-> I have ASP.NET AJAX calendar controls "From Date" and "To Date"$0$0-> OnClientDateSelected of FromDate, I am calling following javascript method$0$0$0function FlightFromChanged(sender, e)$0$0{$0$0    var objToCalendar = $find("<%= _flightToCalenderClientID  %>");$0$0    objToCalendar.set_minDate(e._newDate);$0$0    // Value of _newDate is "Sat Sep 27 00:00:00 EDT 2008"; I also tried e._newValue$0$0}$0$0-> now, when I click on "To Date" calendar control, I see only 2 rows!!!! First row has Name of month and year, and 2nd row has only 2 dates!!!! $0$0I wish I could attach actual screen shot also...$0$0-> And yes, If I don't select any thing from first calendar, and just open second calendar, it randers perfectly...$0$0Please help me out, since I have wasted my whole day after this, and still haven't got any solution...$0$0$0$0$0appreciate your help,$0$0Falgun $0$0
  4. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 26 Sep 2008 Link to this post

    Hi Falgun,

    I prepared a sample project for you following your scenario. Please find it attached and let me know if it works as desired and if I missed something from your logic.

    Find more about RadCalendar OnDateSelected client-side event here.

    All the best,
    Iana
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. Falgun
    Falgun avatar
    8 posts
    Member since:
    Sep 2008

    Posted 26 Sep 2008 Link to this post

    HI Iana,$0Unfortunatly the solution doesn't work..$0$0on  "eventArgs.get_renderDay().get_date();", i get "Object doesn't support this property or method"; eventArgs doesn't have get_renderDay method!!!$0$0$0$0$0the only difference from your and my code, is, I added "OnDateSelected" property on the code behind file, since my calendar control is inside a user control; and my javascript function will be declared on main page only...$0$0$0$0$0$0 Public WriteOnly Property OnClientDateSelected() As String$0$0        Set(ByVal value As String)$0$0            RadDPicker.ClientEvents.OnDateSelected = value$0$0        End Set$0$0 End Property$0$0and javascript method I have is,$0$0$0  function CalendarDateSelected(sender, eventArgs)$0$0  {$0$0   var toDateCalendar = $find("<%= RadCalendar2.ClientID %>");$0$0        debugger;$0$0        var date = eventArgs.get_renderDay().get_date();$0$0  }$0$0$0$0$0Falgun$0$0$0
  6. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 26 Sep 2008 Link to this post

    Hello Falgun,

    From the additional information provided, I see that you are using RadDatePicker controls. As I used RadCalendar in my sample, I needed to midify it for your case. Please find it attached and let me know if this is the desired functionality.

    Regards,
    Iana
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  7. Falgun
    Falgun avatar
    8 posts
    Member since:
    Sep 2008

    Posted 26 Sep 2008 Link to this post

    this is not working either... becausse you are doing the same thing what I was doing..$0I was doing  var newdate = e._newDate; while, you are calling get_newDate() method!!!$0$0this doesn't work.. second calendar doesn't rander properly after I set minDate for that; it just displays two rows and two columns...$0$0I would really like to attach a screen shot of how it looks, so you might have better visualisation; but I don't knw if there is any way of doing that... $0$0kindly give me your mail id, or mail me on fpatel@aaasouth.com so I can reply you back with actual screen shot..$0$0$0$0$0Thanks for your quick replies..$0$0$0$0$0Falgun$0$0$0$0
  8. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 26 Sep 2008 Link to this post

    Hello Falgun,

    Could you please clarify, are you facing the issue directly running the sent project or you are copying the code into your project?

    If you would like to send me some files, you need to open a formal support ticket and there you will have the ability to attach screenshot or code files.

    Kind regards,
    Iana
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  9. Falgun
    Falgun avatar
    8 posts
    Member since:
    Sep 2008

    Posted 26 Sep 2008 Link to this post

    Hi Iana,$0Yes, you were right, I was copying the code to my code... when I tried to run your solution, it runned perfectly...$0$0I don't know what is wrong with my code...$0$0here is how I have everything set up...$0$01) My DatePicker control is inside a user control.$0$02) Ths user control has Date Picker control and custome label and error message label$0$03) I hae 2 instances of the user control on the page.$0$04) Inorder to access OnDateChanged event of DatePicker control, I created a public property in the user control$0$0OnClientDateSelected() As String$0$0  Set(ByVal value As String)$0$0            RadDPicker.ClientEvents.OnDateSelected = value$0$0 end$0$0End Property$0$0$0$0$0everything you have done works fine... but I think, since I am putting rad control inside a user control... it's not rendering properly??$0$0$0$0
  10. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 29 Sep 2008 Link to this post

    Hello Falgun,

    Please find the modified sample attached and let me know if I missed something from your logic.

    Regards,
    Iana
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  11. Falgun
    Falgun avatar
    8 posts
    Member since:
    Sep 2008

    Posted 29 Sep 2008 Link to this post

    Hi Iana,
    yeah, the logic is slightly different...
    I have only ONE DATE PICKER control in side the User control.
    I have two instances of user control on my page; userControlStartDate and userControlEndDate;
    inorder to access DatePicker control from the script, I exposed it's ClientID, and OnDateSelected as a public property of the User Control.
    so, to sum up, you need to change your WebUsercontrol to have only ONE DATEPICKER control; and have 2 instances of UserControls on your page....

    I am eager to see if that works,
    Thanks,
    Falgun    
Back to Top