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

RadMonthYearPicker event in a user control

15 Answers 185 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Zenute Marins
Top achievements
Rank 1
Zenute Marins asked on 08 Oct 2011, 05:01 PM
It seems RadMonthYearPicker is not firing SelectedDateChanged when it´s part of a web user control. Although AutoPostBack is set to true the event is not fired.Am i missing something here or I might expect a different behaviour when it´s running in a .ascx?

15 Answers, 1 is accepted

Sort by
0
Zenute Marins
Top achievements
Rank 1
answered on 08 Oct 2011, 09:29 PM
In fact, RadMontYearPicker only fires the event if  month is changed. If year is changed the event is never fired. The selecteddate always returns 2011 no matter what year is set.
Very frustratng!
Is this a bug? Any known work around?
0
Stuart Hemming
Top achievements
Rank 2
answered on 09 Oct 2011, 06:38 PM
Zenute,

Have you looked at the MonthYear Picker Server-side Programming demo? This seems to fire the event as you would expect when changing the month, the year or both.

Compare your code (or cut it back) with the demo and see if you spot anything you are doing differently.

Just out of interest, what version of RadControls are you using?

-- 
Stuart
0
Stuart Hemming
Top achievements
Rank 2
answered on 09 Oct 2011, 07:59 PM
Zenute,

Have a look at the attached .zip file.

It includes a simple user control containing a RadMonthYearPicker and a page that uses it.

This Jing video shows it in action and as you can see, the event fires when you change the month, the year or both.

-- 
Stuart
0
Zenute Marins
Top achievements
Rank 1
answered on 10 Oct 2011, 04:21 PM

Stuart,

I had a look at the demo, and it seems I´m doing things in the right way.
Unfortunately, the control only fires selecteddatechanged when I change the month value. I also tried the control in an aspx page and the monthyearpicker control behaved exactly the same way. The event is fired if month is changed. The event is not fired if year is changed. Year is always 2011.

My RadControls version is 2011.2.712.40.

I thought it might be sometinhg related to culture. The culture is set to pt-BR.

Thank you
0
Zenute Marins
Top achievements
Rank 1
answered on 10 Oct 2011, 08:33 PM
Stuart,
I´m new to Telerik and it´s the first time I´m using it in a production project, so maybe its just that I´m not yet comfortable in working with it. But in less than a month , I was fustrated twice. The first one is with this radmonthyearpicker event issue, which seems so trivial and obvious to me that I can´t believe it´s not working. And the second one is that it seems that I´m facing again an old and well known beast named DLL hell.
 
I´ve just found out that RadControls (Telerik.Web.UI) newest version is in a folder named Telerik.Web.UI_2011_2_915_Dev_hotfix, created by an online update.

I must confess that I´m  a bit confused here.
So we have a version in C:\Program Files (x86)\Telerik\RadControls for ASP.NET AJAX Q2 2011\Bin40 and a newer one in C:\Users\zenute\AppData\Roaming\Telerik\Updates\Telerik.Web.UI_2011_2_915_Dev_hotfix\Bin40?

If this smells and tastes like DLL hell , it sure is a DLL hell.

Anyway, both dlls have the same behavior. They only fire SelectedDateChanged when month is changed. Year is stuck to 2011, no matter what I do.


0
Stuart Hemming
Top achievements
Rank 2
answered on 11 Oct 2011, 08:19 AM
Zenute,

First, I can't really believe that this problem is related to your culture settings, but if it is I'm sure a grown-up will be along shortly to tell us.

You should prolly update the references to the telerik DLL in your project, I have to confess I'm using the latest release (2011.2.915.40) and the code I sent you was run using that.

I'm unsure why your hotfix has been installed in the location it has, but you should reinstall it in the correct location (for no other reason than having it where it is makes no real sense).

Update the references in you project to the 915 version and try again.

-- 
Stuart
0
Radoslav
Telerik team
answered on 11 Oct 2011, 11:21 AM
Hi Zenute,

Indeed I verified that the described issue exists in the current version of our controls when the culture is set to pt-BR. I forwarded the issue to our developers and they will start working on its resolution. At a meantime you could try using the following workaround:
Handle the OnValueChanging and replace the "de" separator with "/":
<telerik:RadCodeBlock runat="server">
    <script type="text/javascript">
        function OnValueChanging(sender, eventArgs)
        {
            var newValue = eventArgs.get_newValue().replace(" de ", "/")
            eventArgs.set_newValue(newValue);
        }
    </script>
</telerik:RadCodeBlock>
<telerik:RadMonthYearPicker AutoPostBack="true" runat="server" ID="RadMonthYearPicker1">
        <ClientEvents OnValueChanging="OnValueChanging" />
</telerik:RadMonthYearPicker>

Additionally I am sending you a simple example, please check it out and let me know if it helps you.

Best wishes,
Radoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Stuart Hemming
Top achievements
Rank 2
answered on 11 Oct 2011, 11:57 AM
Stone me! It is culture related.

-- 
Stuart
0
Zenute Marins
Top achievements
Rank 1
answered on 12 Oct 2011, 12:17 AM
Radoslav,

Thank you. The workaround did the trick. I expect Telerik´s developers fix this issue soon.

Stuart,

When I saw your code working, I realized that the problem should be related to culture settings.
Thank you for your time and your help.
0
Zenute Marins
Top achievements
Rank 1
answered on 13 Oct 2011, 01:58 PM
Radoslav,

There is an easier way, without javascript coding. I just set dateformat and displaydateformat to MMMM' / 'yyyy.
It worked like a charm.

thank you.

0
John
Top achievements
Rank 1
answered on 02 Feb 2012, 02:09 PM
I am having this same issue where the MonthYear Picker does not return anything but the current year, except I have culture en-US.  I am running version v2011.3.1115.35.  Can I get an update on this fix?  The work around does not work for my case.  I want a DateFormat = MM/yy returned.
0
John
Top achievements
Rank 1
answered on 03 Feb 2012, 01:11 PM
Put in a support ticket on this issue.  I have included support's response for future developers using this control.  I appreciate support's response and will code my own control to function according to my needs. 
Maybe someone can explain the logic of having a MonthYear picker control that operates on Month, Day & Year.....

RadMonthYearPicker uses RadDateInput for input. However RadDateInput does not support DateFormat which has the day, month or year parts missing. You should either change the DateFormat in your case, or try the approach illustrated in this code library
http://www.telerik.com/community/code-library/aspnet-ajax/calendar/how-to-use-raddatepicker-with-a-quot-mm-yyyy-quot-formatted-dateinput.aspx

0
Radoslav
Telerik team
answered on 06 Feb 2012, 10:49 AM
Hello John,

The purpose of the RadMonthYearPicker control is to choose month and year. However the .NET framework does not have structure which could keep only month and year, so the RadMonthYearPicker keeps month and year into the DateTime object. Into this object the date part is populated by default from the picker control. The user could not see the date part and could not change it. The end user could only choose or change month and year. The developers also could get the selected date into the code behind and extract the month and year part and do whatever they want with this parts. Into the code behind you could get the entire date object kept into the SelectedDate property of the control, save it into the database or operate directly with it.

Regards,
Radoslav
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
John
Top achievements
Rank 1
answered on 06 Feb 2012, 01:05 PM
Thanks for the additional information.  However, I'm not sure my point regarding the control has been heard.  Try this on the Telerik demo site for the MonthYear picker (http://demos.telerik.com/aspnet-ajax/calendar/examples/monthyearpicker/firstlook/defaultcs.aspx).  Manually type in a month and year formatted "MM/yyyy" into the control, do not select the month & year, key it and then tab out.  The month and year that is typed should not be the current month or the current year.  The date shown after tabbing out of the control will not be the date you typed, it will contain the current month or year in the results.  In my mind this is an error, bug or incorrect fuctionality with the parsing.  Some users will not use the picker, they will key the information.  If you type a month/day/year, the return value after tabbing will be correct.  At best this will be confusing for the user, at worst it will generate multiple calls into the help desk.

Hopefully I have made my issue clear.  In my case I decided to remove the control and create my own which will not be confusing or generate unneeded calls into the help desk.
Thanks
John
0
Radoslav
Telerik team
answered on 09 Feb 2012, 08:43 AM
Hi John,

Thank you for the feedback, I will forward it to our developers for further consideration. At a meantime you could try using the approach suggested into the previously provided link:
http://www.telerik.com/community/code-library/aspnet-ajax/calendar/how-to-use-raddatepicker-with-a-quot-mm-yyyy-quot-formatted-dateinput.aspx

Kind regards,
Radoslav
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
General Discussions
Asked by
Zenute Marins
Top achievements
Rank 1
Answers by
Zenute Marins
Top achievements
Rank 1
Stuart Hemming
Top achievements
Rank 2
Radoslav
Telerik team
John
Top achievements
Rank 1
Share this question
or