Resource Collection in RadScheduler

47 posts, 0 answers
  1. anu
    anu avatar
    44 posts
    Member since:
    Dec 2007

    Posted 24 Dec 2007 Link to this post

    Hi All,

    I use RadScheduler in my application...created resource collection and populated with some data.....but in the drop down by default the first list item is dispalyed as '-' which I dont want. Because if we insert appointment by selecting '-' in the resource type, null value is inserted into the database in that particular cell. So, please let me know how to delete that '-' from the list items.

    Thanks
  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 27 Dec 2007 Link to this post

    Hello Anu,

    This behavior is by design. If no resource of a specific type is associated with the appointment, the "-" option is selected for the dropdown list. You can use Templates to change the default behavior. If you specify what exactly should happen in the case when no resource of a certain type is associated with the appointment, we will provide with a solution.



    Kind regards,
    Peter
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. anu
    anu avatar
    44 posts
    Member since:
    Dec 2007

    Posted 27 Dec 2007 Link to this post

    Hi Peter,

    Thank you for the reply.
    In that case, if the user dont select any resource and clicks submit, then a message should be displayed saying that "Please select...."(its like requiredfield validator) and also the appointment insertion should be cancelled.

    Regards
  5. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 27 Dec 2007 Link to this post

    Hi Anu,

    Thanks for clarifying. You can try the following solution:

     <telerik:RadScheduler ID="RadScheduler1" runat="server"   
               OnAppointmentInsert="RadScheduler1_AppointmentInsert" 
              OnAppointmentUpdate="RadScheduler1_AppointmentUpdate">  
                <ResourceTypes> 
                    <telerik:ResourceType DataSourceID="SqlDataSource2" ForeignKeyField="UserID" KeyField="ID" 
                        Name="Users" TextField="UserName" /> 
                </ResourceTypes> 
            </telerik:RadScheduler> 


    protected void RadScheduler1_AppointmentInsert(object sender, Telerik.Web.UI.SchedulerCancelEventArgs e)  
        {  
            if (e.Appointment.Resources.GetResourceByType("Users") == null)  
            {  
                Response.Write("Please, select a user.");  
                e.Cancel = true;          
            }  
        }  
    protected void RadScheduler1_AppointmentUpdate(object sender, Telerik.Web.UI.AppointmentUpdateEventArgs e)  
        {  
            if (e.ModifiedAppointment.Resources.GetResourceByType("Users") == null)  
            {  
                Response.Write("Please, select a user.");  
                e.Cancel = true;  
            }  
        } 




    All the best,
    Peter
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. anu
    anu avatar
    44 posts
    Member since:
    Dec 2007

    Posted 27 Dec 2007 Link to this post

    Hi Peter,

    Thank you for ur support....its working(ofcourse if we write response.write(), its throwing error, so replaced with msgBox()).

    I also want to know whether we can insert radiobuttons or textboxes in that appointment filling form(may be in the resource collection or may be outside the resource collection in the RadScheduler)
  7. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 28 Dec 2007 Link to this post

    Hi Anu,

    Here is an example. Please, consider the Database Scheduler Provider example and try the following code with it:

     <AdvancedEditTemplate> 
                    <asp:TextBox ID="TitleTextBox" Rows="5" Columns="20" runat="server" Text='<%# Bind("Subject") %>' 
                        Width="95%" TextMode="MultiLine"></asp:TextBox> 
                    <div style="position: relative">  
                        <span>Teachers:</span><br /> 
                        <asp:CheckBoxList ID="TeachersCheckBoxList" runat="server">  
                        </asp:CheckBoxList> 
                    </div> 
                    <br /> 
                    <br /> 
                    <div> 
                        <span>Students:</span><br /> 
                        <asp:CheckBoxList ID="StudentsCheckBoxList" runat="server">  
                        </asp:CheckBoxList> 
                    </div> 
                    <asp:LinkButton ID="UpdateButton" runat="server" Text="Update" CommandName="Update" /> 
                </AdvancedEditTemplate> 

    protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e)  
            {  
                
                CheckBoxList teachers = (CheckBoxList)e.Container.FindControl("TeachersCheckBoxList");  
                     
                   foreach (Resource r in RadScheduler1.Resources.GetResourcesByType("Teacher"))  
                    {  
                       ListItem listitem1 = new ListItem(r.Text, r.Key.ToString());  
                       listitem1.Selected = ResourceIsInUse(r, e.Appointment);  
                       teachers.Items.Add(listitem1);  
                        
                    }  
                    CheckBoxList students = (CheckBoxList)e.Container.FindControl("StudentsCheckBoxList");  
     
                    foreach (Resource r in RadScheduler1.Resources.GetResourcesByType("Student"))  
                    {  
                        ListItem listitem1 = new ListItem(r.Text, r.Key.ToString());  
                        listitem1.Selected = ResourceIsInUse(r, e.Appointment);  
                        students.Items.Add(listitem1);  
                        
                    }  
       
                 
            }  
            private bool ResourceIsInUse(Resource res, Appointment a)  
            {  
                foreach (Resource appRes in a.Resources)  
                {  
                    if (res == appRes)  
                    {  
                        return true;  
                    }  
                }  
     
                return false;  
            }  
            protected void RadScheduler1_AppointmentCommand(object sender, AppointmentCommandEventArgs e)  
            {  
                CheckBoxList teachers = (CheckBoxList)e.Container.FindControl("TeachersCheckBoxList");  
                CheckBoxList students = (CheckBoxList)e.Container.FindControl("StudentsCheckBoxList");  
                e.Container.Appointment.Resources.Clear();  
                  
                  
                    foreach (ListItem item1 in teachers.Items)  
                    {  
                        if (item1.Selected)  
                        {  
                            Resource teacher = RadScheduler1.Resources.GetResource("Teacher"int.Parse(item1.Value));  
                            e.Container.Appointment.Resources.Add(teacher);  
                        }    
                    }  
                 
                   foreach (ListItem item1 in students.Items)  
                    {  
                        if (item1.Selected)  
                        {  
                            Resource student = RadScheduler1.Resources.GetResource("Student"int.Parse(item1.Value));  
                            e.Container.Appointment.Resources.Add(student);  
                          
                        }                         
                    }            
            } 

    Let us know if you have any questions.


    Regards,
    Peter
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  8. anu
    anu avatar
    44 posts
    Member since:
    Dec 2007

    Posted 28 Dec 2007 Link to this post

    Hi Peter,

    Thank you for the reply.
    When I insert radiobuttonlist or text box in AdvancedEditTemplate or AdvancedInsertTemplate, and when I want to insert a appointment, its displaying only the radiobuttonlist or textbox, its not displaying all the fields like description field, start time, end time, resource types.....

    I want every thing on the appointment insert form(including radiobutton in the templates), please let me know the procedure.

    Also one more question in that appointment insert form, is it possible that if I select one list item in the radiobutton list, then based on that event a new dropdownlist(may be resource type) should be dispalyed?

    Regards
  9. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 28 Dec 2007 Link to this post

    Hello Anu,

    That's understandable. Sorry for not providing you with a more complete solution. You need to create the other controls using Templates. Please, follow the online example and let us know if you have questions.  


    All the best,
    Peter
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  10. anu
    anu avatar
    44 posts
    Member since:
    Dec 2007

    Posted 02 Jan 2008 Link to this post

    Hi,

    Here I have another question, in the normal scheduler, while inserting appointment in the appointment form, if we select recurring appointment check box then other fields like recurrence and range of recurrence gets displayed. Then how this can be achieved using the templates???

    My requirement is if given a field with options(radio button list) yes/no....a drop down should be dispalyed when the user selects 'yes'.


  11. anu
    anu avatar
    44 posts
    Member since:
    Dec 2007

    Posted 03 Jan 2008 Link to this post

    Please answer my above query at the earliest.

    Thanks.
  12. anu
    anu avatar
    44 posts
    Member since:
    Dec 2007

    Posted 04 Jan 2008 Link to this post

    Anybody there to answer my query???
    It has been 2 working days already but no answer.
  13. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 08 Jan 2008 Link to this post

    Hello Anu,

    We understand what you want to achieve and it makes perfect sense. Unfortunately, RadScheduler doesn't support this functionality yet. However, I have discussed your inquiry with our development team and we will consider exposing a template which will allow partial customization of the advanced form, while preserving the functionality related to recurrence and resources.


    Kind regards,
    Peter
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  14. Richardsonke
    Richardsonke avatar
    93 posts
    Member since:
    Jul 2007

    Posted 10 Jan 2008 Link to this post

    I would like to agree with this request.  Partial customization of the form is very important to us, as we would not like to recreate all of the features of the existing form.
  15. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 11 Jan 2008 Link to this post

    Hello guys,

    Thanks for your involvment. We will try to implement this feature as soon as possible.


    Regards,
    Peter
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  16. Ville Tenhunen
    Ville Tenhunen avatar
    2 posts
    Member since:
    Sep 2006

    Posted 26 Mar 2008 Link to this post

    Hi Peter,

    have you allready scheduled this to implementation? We are really waiting for this feature.

    Br,

    Sami
  17. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 26 Mar 2008 Link to this post

    Hi Sami,

    I am glad to inform you that the Customizing the Advanced Template example is already finalized. The accompanying help article is not live yet, so I am sending it to you as a word document.

    The user controls can be found in your local installation of of the latest Telerik.Web.UI Futures (attached is a screenshot of which file you need to download) at this location:

    Live Demos\Scheduler\Examples\AdvancedFormTemplate\DefaultTemplates

    Should you have any questions, please feel free to contact us.



    All the best,
    Peter
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  18. Ville Tenhunen
    Ville Tenhunen avatar
    2 posts
    Member since:
    Sep 2006

    Posted 26 Mar 2008 Link to this post

    Thank you! That will help us alot!
    We'll try implementin it to our software right away.

    Br,

    Sami
  19. Chris Phelps
    Chris Phelps avatar
    10 posts
    Member since:
    Jan 2010

    Posted 31 Jan 2011 Link to this post

    If a resource is not selected, can we set it in code somehow before the appointment is saved?

    In both advanced and regular insert/edit modes?

    Without using Templates?
  20. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 31 Jan 2011 Link to this post

    Hello Chris,

    Yes, you can handle AppointmentInsert and AppointmentUpdate(e.ModifiedAppointment) to achieve this. For example:
    protected void RadScheduler1_AppointmentInsert(object sender, AppointmentInsertEventArgs e)
      {
          if (e.Appointment.Resources.GetResourceByType("User") == null)
              e.Appointment.Resources.Add(new Resource("User", 1, "Alex"));
      }


    Regards,
    Peter
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  21. Chris Phelps
    Chris Phelps avatar
    10 posts
    Member since:
    Jan 2010

    Posted 31 Jan 2011 Link to this post

    Perfect, thank you.

    I would like to have a second resource, but not let the end user choose the value of that resource.  So I would need the combo box hidden so they don't see an empty combo box on the advancedinsert form.  Is that possible?
  22. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 02 Feb 2011 Link to this post

    Hello Chris,

    Yes, you can access the resource RadComboBox in FormCreated and set its Visible property to false. Here is a kb article for reference -

    http://www.telerik.com/support/kb/aspnet-ajax/scheduler/how-to-access-controls-in-the-advanced-form.aspx


    Kind regards,
    Peter
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  23. Chris Phelps
    Chris Phelps avatar
    10 posts
    Member since:
    Jan 2010

    Posted 04 Feb 2011 Link to this post

    Thank you again, that works!
  24. Felipe
    Felipe avatar
    13 posts
    Member since:
    Jun 2011

    Posted 08 Sep 2011 Link to this post

    Hello!

    Going back to the first question: "How to display a message if no resource value is selected"

    I want to achieve it with something similar as the SubjectValidator in the AdvancedForm (see attached image).

    How can I do that?
  25. Felipe
    Felipe avatar
    13 posts
    Member since:
    Jun 2011

    Posted 09 Sep 2011 Link to this post

    Hello?

    Anybody outhere?

    I need help!
  26. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 13 Sep 2011 Link to this post

    Hello Felipe,

    You can download a sample from the code library that shows amongst many other scenarios how to add a new custom validator for the description field. You can follow the approach and adapt it for a resource validation as well.

    Greetings,
    Peter
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  27. v-govinr@microsoft.com
    v-govinr@microsoft.com avatar
    18 posts
    Member since:
    Jun 2010

    Posted 20 Sep 2011 Link to this post

    Hi,

    I am trying modify the default edit appointment form using <AdvanceEditTemplate>. After adding controls to this template, when i click any appointment .. Edit form is not opening...simply page is getting refreshed.

    code is like this in my  .aspx page,

    <telerik:radscheduler ID="RadScheduler1" runat="server" SelectedView="MonthView"
           Font-Bold="False"  Height="485px"
           Width="824px"  EnableEmbeddedBaseStylesheet="true"
           EnableEmbeddedSkins="true" style="margin-right: 16px" 
             Skin="Vista" onformcreated="RadScheduler1_FormCreated" onprerender="RadScheduler1_PreRender"
    OnAppointmentCommand="RadScheduler1_AppointmentCommand">
         <MonthView HeaderDateFormat="MMMMMMMM, yyyy"  />
           <Localization HeaderTimeline="Agenda"   />
                      <AdvancedEditTemplate>
                   <asp:TextBox ID="TitleTextBox" Rows="5" Columns="20" runat="server"
                       Width="95%" TextMode="MultiLine"></asp:TextBox>
                   <div style="position: relative"
                       <span>Teachers:</span><br />
                       <asp:CheckBoxList ID="TeachersCheckBoxList" runat="server"
                       </asp:CheckBoxList>
                   </div>
                   <br />
                   <br />
                   <div>
                       <span>Students:</span><br />
                       <asp:CheckBoxList ID="StudentsCheckBoxList" runat="server"
                       </asp:CheckBoxList>
                   </div>
                   <asp:LinkButton ID="UpdateButton" runat="server" Text="Update" CommandName="Update" />
               </AdvancedEditTemplate>
        </telerik:radscheduler>
    At this moment i am not binding any data to controls inside the template. But in future i have to..
    Please help me..
  28. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 20 Sep 2011 Link to this post

    Hi V-Govinr@Microsoft.Com,

    How do you handle FormCreated?

    If the advanced form is modal, please use this topic - http://www.telerik.com/help/aspnet-ajax/scheduler-custom-modal-advanced-template.html.


    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
  29. v-govinr@microsoft.com
    v-govinr@microsoft.com avatar
    18 posts
    Member since:
    Jun 2010

    Posted 21 Sep 2011 Link to this post

    Hi Peter,

         In the Form created event , I am just binding the data to the controls which are inside Advanced template.

         But ,i hope there is no difference between Advanced template which i have designed and posted in this thread and the example you provided..

        Can you please provide a sample application .. so that it will give better clarity on this.
    Thanks ,
    Govind.
  30. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 21 Sep 2011 Link to this post

    Hello V-Govinr@Microsoft.Com,

    If you use the Advanced Templates, there is no need to handle FormCreated. You can download a sample from here.

    Best wishes, 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
  31. Jose
    Jose avatar
    13 posts
    Member since:
    May 2009

    Posted 21 Feb 2012 Link to this post

     

    Hello

    I have a Resource that I'm loading from code. This resource renders as a drop down. (See attached) I want to know if there is a way to access the drop down in the code behind or client side so I can hide or disable the drop down.

    Your help will be truly appreciated.

    Also you might notice that time and date show is 2 different lines. I'm not Shure why. If you can shed some light on this I’ll appreciate it also

    Thank you!

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017