0

I'm using Telerik RadGrids and I have RadDatePickers for columns with type of DateTime. However, when I want to pick a date it doesn't work at all. No errors, but it's simply not working. I've noticed that strangely I could select more days, but I want to be able to select a single day by clicking once on the given day.

I've observed that when clicking on the previous/next month I can select a day exactly as I would like, so there is a hack which might work (in my research it worked perfectly after the first postback, but before the first postback it didn't work at all):

Public Sub PageInit(ByVal sender As Object, ByVal e As
System.EventArgs)
    Me.Page.ClientScript.RegisterStartupScript(GetType(TTControls.TTAjaxState),
"Page_Init_" & Me.UniqueID, "if (!(hasEndRequest)) var hasEndRequest =
false; if (!(hasEndRequest)) {var prm =
Sys.WebForms.PageRequestManager.getInstance();prm.add_endRequest(function()
{$('.rcPrev').click();console.log('clicked');});} hasEndRequest =
true;", True)
End Sub

In the code above you can see a method which will be a handler for page init.

However, I would very much like to be able to select a day by clicking on the RadDatePicker and clicking on a day. Here is how my RadDatePicker looks like:

enter image description here

If anybody knows the solution and decides to share it with me (if the solution is not a hack then I would be extremely happy) I would be very gladful.

Thank you in advance, Lajos Árpád.

Lajos Arpad
  • 64,414
  • 37
  • 100
  • 175

3 Answers3

1

Will it demand a lot of work to replace your RadDateTimePicker by a RadCalendar?

The RadCalendar supports the property SelectionMode..

Francis P
  • 13,377
  • 3
  • 27
  • 51
  • I think it would require a lot of energy, but maybe I can find a general solution for that, however, there is no guarantee at all that this is possible or viable for this project, we'll have to think about that. I upvote your answer, because it shares useful information (thank you very much), but I can't accept it because it is not a solution for the problem, it is providing a possible alternative. – Lajos Arpad Jul 09 '12 at 14:03
  • Hmmm... Your answer might be good, I'll try this logic: CType(currentControl, RadDatePicker).Calendar.RangeSelectionMode = Telerik.Web.UI.Calendar.RangeSelectionMode.None – Lajos Arpad Jul 09 '12 at 14:07
  • No this didn't help. I've also tried with the following properties: EnableRepeatableDaysOnClient and EnableMultiSelect (by setting them to false) – Lajos Arpad Jul 09 '12 at 14:39
  • No choice but to javascript a OnClientClick event that clears any selection before affing the new selection..? – Francis P Jul 09 '12 at 14:44
  • I hope there is a more elegant choice than the one mentioned in your previous command, but I'm skeptical. – Lajos Arpad Jul 09 '12 at 15:05
0

Have you set the SelectionMode property to Single?

Francis P
  • 13,377
  • 3
  • 27
  • 51
0

Solution:

    Sys.Application.add_load(function () {
        $(".RadCalendar.RadCalendar_Default .rcPrev").each(function () { $(this).click(); });
    });
Lajos Arpad
  • 64,414
  • 37
  • 100
  • 175