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

MinutesPerRow not well refreshed

17 Answers 191 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Mike Taylor
Top achievements
Rank 1
Mike Taylor asked on 15 Dec 2009, 11:33 AM

Hello,

I would like to allow the users to select the number of minutes per row of the Scheduler themselves.

I'm trying to reproduce a small part of the Scheduler customization demo page available there:
http://demos.telerik.com/aspnet-ajax/scheduler/examples/customization/defaultcs.aspx

In my very simple example, I only have a drop down list to select the number of minutes and a Scheduler component with no datasource.


Page:
        <telerik:RadScriptManager runat="server" ID="RadScriptManager1" /> 
          
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
            <AjaxSettings> 
                <telerik:AjaxSetting AjaxControlID="Panel1">  
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="Panel1" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
            </AjaxSettings> 
        </telerik:RadAjaxManager> 
        <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1" /> 
          
        <asp:Panel runat="Server" ID="Panel1">  
                Minutes per row:   
                <asp:DropDownList runat="server" ID="MinutesPerRow" AutoPostBack="true">  
                    <asp:ListItem Value="60" Text="60"></asp:ListItem> 
                    <asp:ListItem Value="30" Text="30" Selected="true"></asp:ListItem> 
                    <asp:ListItem Value="15" Text="15"></asp:ListItem> 
                    <asp:ListItem Value="10" Text="10"></asp:ListItem> 
                </asp:DropDownList> 
                         
            <telerik:RadScheduler runat="server" ID="RadScheduler1"   
                 ShowFullTime="true" OverflowBehavior="Expand" 
                 DataKeyField="ID" DataStartField="Start" DataEndField="End" DataSubjectField="Subject" >                 
            </telerik:RadScheduler> 

Code behind:
    protected override void OnPreRender(EventArgs e)  
    {  
        base.OnPreRender(e);  
 
        RadScheduler1.MinutesPerRow = int.Parse(MinutesPerRow.SelectedValue);  
    } 

This example completely failed.
When I select a value in the drop down list the Panel is refreshing but the Scheduler is still displaying the previous selected value.
I have to do a second post back to obtain the correct layout.

Did I forget something?

Thank you for you help.


17 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 17 Dec 2009, 05:12 PM
Hello Mike,

You should use Rebind() to refresh RadScheduler:

protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);
  
        RadScheduler1.MinutesPerRow = int.Parse(MinutesPerRow.SelectedValue);
        RadScheduler1.Rebind();
    }


Cheers,
Peter
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Mike Taylor
Top achievements
Rank 1
answered on 21 Dec 2009, 04:38 PM

Thank you it works great now but it means your live example is incomplete.

However I tried to go further and tested this functionality on client side (with a RadScheduler populated with a Web Service).

I added an input button which calls the following javascript fucnction on the OnClick event:

 

 

 function Btn_onClick() {  
     var scheduler = $find("<%= RadScheduler1.ClientID %>");  
     scheduler.set_minutesPerRow(15);  
     scheduler.set_timeLabelRowSpan(4)  
     scheduler.set_selectedDate(scheduler.get_selectedDate());  
 }       

I encounter a very strange problem as you can see on the image I attached.

When MinutesPerRow = 15 is setted, the day ends not at 23:59 but at 01:00 of the next day.

When MinutesPerRow = 20 is setted, the days ends not at 23:59 but at 21:59.

 

It seems there’s something very strange and I can’t achieve what I would like.

Is there a solution for this problem?

0
Mike Taylor
Top achievements
Rank 1
answered on 21 Dec 2009, 05:14 PM
I forgot to mention that each time you click on the button it adds new lines in the scheduler.
0
T. Tsonev
Telerik team
answered on 23 Dec 2009, 04:06 PM
Hi Mike,

When using Web Service binding, RadScheduler renders the control structure on the server for both increased performance and reduced JavaScript size. This means that changing view parameters such as MinutesPerRow and TimeLabelRowSpan is not supported on the client and requires full postbacks. We can offer help with this approach if needed.

The supported operations are changing the selected date, adding/editing/removing appointments and switching views. Some other operations can be achieved with custom code, but changing the MinutesPerRow property is not amongst them.

I hope this helps.

Greetings,
Tsvetomir Tsonev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Mike Taylor
Top achievements
Rank 1
answered on 23 Dec 2009, 05:01 PM

Hi,

 

Ok I understand but I’m wondering why these two functions (set_minutesPerRow & set_timeLabelRowSpan) are available on client side if they are not supported?

In which case/situation are they useful?

 

I’m trying the server-side approach to achieve this functionality with my RadScheduler populated with a web service.

I added an asp:Button with the following server-side code on the onClick event:

 

 

    protected void OnClick(object sender, EventArgs e)  
    {  
        RadScheduler.MinutesPerRow = 10;  
        RadScheduler.TimeLabelRowSpan = 6;  
        RadScheduler.Rebind();  
    } 

 

I don’t specified a default selected date (so when the page loads the scheduler displays the current day) and the default view type is DayView.

 

Everything is working well except when I change on client-side the date and then click on the button. The page loads at the current day again (which is absolutely normal).

But I would like to keep the last date selected by the customer, so find a way to get this date and set it to the scheduler.

 

Is there a simple way to do that?

 

Thank you.

0
Accepted
Peter
Telerik team
answered on 25 Dec 2009, 10:07 AM
Hello Mike,

I have forwarded your question about the set_minutesPerRow and set_timeLabelRowSpan methods to our developers who will be able to answer it next week.

As for the other question, handle OnClientNavigationComplete to store the currently selected date in a hidden field. Then parse the value in code behind and set RadScheduler's SelectedDate property:

<script type="text/javascript">   
    function OnClientNavigationComplete(sender, eventArgs) {      
        var currentlySelectedDate = document.getElementById("currentlySelectedDate");
        currentlySelectedDate.value = sender.get_selectedDate().format("yyyy/MM/dd");
    }
    </script>
      
    <asp:Button ID="Button1" runat="server" Text="button" onclick="Button1_Click" />   
    <asp:HiddenField ID="currentlySelectedDate" runat="server" />
    <telerik:RadScheduler
        runat="server" 
        ID="RadScheduler1" * * * />

protected void Button1_Click(object sender, EventArgs e)
       {
           RadScheduler1.MinutesPerRow = 10;
           RadScheduler1.TimeLabelRowSpan = 6;
           if(currentlySelectedDate.Value != null)
               RadScheduler1.SelectedDate = DateTime.Parse(currentlySelectedDate.Value);
           RadScheduler1.Rebind(); 
       }


Best wishes,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Mike Taylor
Top achievements
Rank 1
answered on 31 Dec 2009, 08:46 AM
Thank you very much Peter, it works great !
0
Camilo Torres
Top achievements
Rank 1
answered on 21 Nov 2011, 05:20 PM
Hi Peter,

I have similar issue but I am using RadScheduler in MVC. It would be kind if you can help identify how to set MinutesPerRow property on server side (or in client side) in MVC.

Thanks in advance.
0
Peter
Telerik team
answered on 23 Nov 2011, 10:23 AM
Hello Camilo,

This is an MVC related question and I cannot advise you on an expert level with this. I suggest you post your question in our MVC forums - http://www.telerik.com/community/forums/aspnet-mvc.aspx.

Greetings,
Peter
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
Santosh
Top achievements
Rank 1
answered on 26 Jul 2012, 11:57 AM
Hi
i am using telrik Rad Schedular and i have need to set dynamic property "minutesPerRow" .but it does duplicate time slot.
i am writing following code.
       var scheduler = $find('<%=MyScheduler1.ClientID %>');
        scheduler.set_minutesPerRow(30);
        scheduler.set_timeLabelRowSpan(2)
        scheduler.rebind();

i have need to set minutesPerRow on client side. because i am using MVC Razor view.
Please help me.
0
Peter
Telerik team
answered on 27 Jul 2012, 03:02 PM
Hello Santosh,

Unfortunately, setting minutes per row client side is not supported. Please, excuse us for this limitation of the control.

Kind regards,
Peter
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
Santosh
Top achievements
Rank 1
answered on 30 Jul 2012, 11:36 AM
Hi peter,
I am using Rad Schedular on ASCX (user control) page and i want to Refresh only Rad Schedular on drop down changed
 not entire page load or referesh.but when i changed the drop down it's refresh the whole page.
i am using following code

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnableAJAX="true">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="MyScheduler1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="MyScheduler1" LoadingPanelID="RadAjaxLoadingPanel1" />
<telerik:AjaxUpdatedControl ControlID="HoursColumn" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1" />
<asp:DropDownList ID="MinutesPerRow" AutoPostBack="true" runat="server">
<asp:ListItem Value="5" Text="10"></asp:ListItem>
<asp:ListItem Value="15" Text="30" ></asp:ListItem>
<asp:ListItem Value="30" Text="60"></asp:ListItem>
</asp:DropDownList><
telerik:RadScheduler ID="MyScheduler1" runat="server" AllowDelete="true"
SelectedView="WeekView" StartInsertingInAdvancedForm="true" ShowHeader="false"
StartEditingInAdvancedForm="true" AllowEdit="true" OnClientDataBound="OnClientDataBound"

Please help me what i have to do.
thanks
0
Peter
Telerik team
answered on 30 Jul 2012, 11:54 AM
Hi Santosh,

Can you add the following ajax setting and check if it helps?

<telerik:AjaxSetting AjaxControlID="MinutesPerRow">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="MyScheduler1" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>


All the best,
Peter
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
Santosh
Top achievements
Rank 1
answered on 30 Jul 2012, 12:09 PM
Hi Peter ,
thanks for replied,
Your posted code refresh the scheduler but Minute per row data not changed on the basis of drop down selection. i am not able to set minutePerRow in schedular. i have written following code on server side.
 protected override void OnPreRender(EventArgs e)
  {
    base.OnPreRender(e);
   MyScheduler1.MinutesPerRow =int.Parse(MinutesPerRow.SelectedValue);    
   MyScheduler1.Rebind(); 
    }
Please help me It's top urgent
0
Peter
Telerik team
answered on 30 Jul 2012, 12:56 PM
Hi,

The PreRender event is propbably too late. Can you try the same code in the SelectedIndexChanged handler of the DropDownList control?


Regards, Peter
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
Santosh
Top achievements
Rank 1
answered on 30 Jul 2012, 02:28 PM
Hi Peter,
combobox selected index does not fire.Basically i am using MVC user control and my schedular and combobox  also placed on usercontrol page.
i have written following code
<telerik:RadComboBox runat="server" ID="MinutesPerRow" AutoPostBack="true" OnSelectedIndexChanged="MinutesPerRow_SelectedIndexChanged">
<Items><telerik:RadComboBoxItem Text="10" Value="5"/>
<telerik:RadComboBoxItem Text="30" Value="15"/>
<telerik:RadComboBoxItem Text="60" Value="30"/></Items>
</telerik:RadComboBox>
 server side code is following
 protected void MinutesPerRow_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
  {
    MyScheduler1.MinutesPerRow = int.Parse(MinutesPerRow.SelectedValue);
    MyScheduler1.Rebind();
  }
Please help me
0
Peter
Telerik team
answered on 02 Aug 2012, 08:37 AM
Hi Santosh,

The MVC environment does not support server-side event handling, so this requirement cannot be implemented.

Kind regards,
Peter
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.
Tags
Scheduler
Asked by
Mike Taylor
Top achievements
Rank 1
Answers by
Peter
Telerik team
Mike Taylor
Top achievements
Rank 1
T. Tsonev
Telerik team
Camilo Torres
Top achievements
Rank 1
Santosh
Top achievements
Rank 1
Santosh
Top achievements
Rank 1
Share this question
or