Scheduler / Resource Availability GroupBy not Working

8 posts, 1 answers
  1. Ruchir
    Ruchir avatar
    10 posts
    Member since:
    Dec 2010

    Posted 11 Jan 2011 Link to this post

    Hi,
        I am working on Scheduler/Resource Availability having problem with groupby property of Scheduler it's not working .

    I am using following code on server side :
    Code Snippet :

    protected void Page_Load(object sender, EventArgs e)
    {
    DataTable tblTest = new DataTable();
    tblTest.Columns.Add("ID");
    tblTest.Columns.Add("RoomID");
    tblTest.Columns.Add("startdate");
    tblTest.Columns.Add("enddate");
    tblTest.Columns.Add("Subject");
    tblTest.Columns.Add("RoomName");
    DataRow drTest;
    drTest = tblTest.NewRow();
    drTest["ID"] = 2;
    drTest["RoomID"] = 2;
    drTest["startdate"] = "2011-01-11 10:00:00.000";
    drTest["enddate"] = "2011-01-11 12:00:00.000";
    drTest["Subject"] = "Scheduled Lesson1";
    drTest["RoomName"] = "Room1";
    tblTest.Rows.Add(drTest);

    drTest = tblTest.NewRow();
    drTest["ID"] = 2;
    drTest["RoomID"] = 2;
    drTest["startdate"] = "2011-01-11 14:00:00.000";
    drTest["enddate"] = "2011-01-11 16:00:00.000";
    drTest["Subject"] = "Scheduled Lesson2";
    drTest["RoomName"] = "Room1";
    tblTest.Rows.Add(drTest);

    drTest = tblTest.NewRow();
    drTest["ID"] = 3;
    drTest["RoomID"] = 3;
    drTest["startdate"] = "2011-01-11 12:00:00.000";
    drTest["enddate"] = "2011-01-11 14:00:00.000";
    drTest["Subject"] = "Scheduled Lesson3";
    drTest["RoomName"] = "Room2";
    tblTest.Rows.Add(drTest);

    drTest = tblTest.NewRow();
    drTest["ID"] = 4;
    drTest["RoomID"] = 4;
    drTest["startdate"] = "2011-01-11 12:00:00.000";
    drTest["enddate"] = "2011-01-11 14:00:00.000";
    drTest["Subject"] = "Scheduled Lesson4";
    drTest["RoomName"] = "Room3";
    tblTest.Rows.Add(drTest);

    RadScheduler2.ResourceTypes[0].DataSource = tblTest;
    RadScheduler2.DataSource = tblTest;
    RadScheduler2.DataBind();

    }

    and following is design part(.aspx)

    <telerik:RadScheduler ID="RadScheduler2" Skin="Vista" runat="server" DataKeyField="ID"
            DataSubjectField="Subject" GroupBy="Room" GroupingDirection="Horizontal" DataStartField="startdate"     DataEndField="enddate"  Height="552px">
            <AdvancedForm Modal="true" />
            <TimelineView UserSelectable="false" />
            <WeekView UserSelectable="false" />
            <MonthView UserSelectable="false" />
            <DayView UserSelectable="false" />
            <ResourceTypes>
                <telerik:ResourceType KeyField="ID" Name="Room" TextField="RoomName" ForeignKeyField="RoomID" />
            </ResourceTypes>
            <AppointmentTemplate>
                <div class="rsAptSubject">
                    <%# Eval("Subject") %>
                </div>
                <%# Eval("Description")%>
            </AppointmentTemplate>
            <TimeSlotContextMenuSettings EnableDefault="true" />
            <AppointmentContextMenuSettings EnableDefault="true" />
    </telerik:RadScheduler>

    You can check its output in attachment.

    Is anything wrong with the code?
    Can you help?


    Thanks & Regards,
    Ruchir

  2. Ruchir
    Ruchir avatar
    10 posts
    Member since:
    Dec 2010

    Posted 12 Jan 2011 Link to this post

    Can anyone help ?
  3. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 12 Jan 2011 Link to this post

    Hello Ruchir,

    From the attached picture I see that Room1 is repeating two times with one and the same appointments in it. The reason for that is because you are adding two data rows with one and the same "RoomName". As a result two resources are created with one and the same name:

    drTest = tblTest.NewRow();
            drTest["ID"] = 2;
            drTest["RoomID"] = 2;
            drTest["startdate"] = "2011-01-11 10:00:00.000";
            drTest["enddate"] = "2011-01-11 12:00:00.000";
            drTest["Subject"] = "Scheduled Lesson1";
            drTest["RoomName"] = "Room1";
            tblTest.Rows.Add(drTest);
      
            drTest = tblTest.NewRow();
            drTest["ID"] = 2;
            drTest["RoomID"] = 2;
            drTest["startdate"] = "2011-01-11 14:00:00.000";
            drTest["enddate"] = "2011-01-11 16:00:00.000";
            drTest["Subject"] = "Scheduled Lesson2";
            drTest["RoomName"] = "Room1";
            tblTest.Rows.Add(drTest);

    Is there any special reson for that?
    To remove the repetition - change the name of the resource.

    Please let me know if I get your requirement right.

    Best wishes,
    Veronica Milcheva
    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.
  4. Ruchir
    Ruchir avatar
    10 posts
    Member since:
    Dec 2010

    Posted 12 Jan 2011 Link to this post

    Hi Veronica,

    The use case here is that there are two different appointments scheduled on a same room. Hence I have added 2 rows with same room name and different appointment time/subject. As a result, I want to show two appointments under same room, but the room shoud appear only once.

    Please let me know if this clarifies the use case and the data I have created.

    Thanks,
    Ruchir.
  5. Ruchir
    Ruchir avatar
    10 posts
    Member since:
    Dec 2010

    Posted 12 Jan 2011 Link to this post

    Hi Veronica,
       Still no reply from your side ???
      
    Thanks,
    Ruchir.  
  6. Ruchir
    Ruchir avatar
    10 posts
    Member since:
    Dec 2010

    Posted 13 Jan 2011 Link to this post

    Hi Veronica,
        Can you help ?



    Thanks,
    Ruchir
  7. Answer
    Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 13 Jan 2011 Link to this post

    Hi Ruchir,

    We are doing our best to answer all of the forum posts. If you need an urgent response - please make a Support ticket next time as the response time is 24 hours.

    The problem with your code is because you are trying to use and and the same data source for the Appointments and the Resources. I've edited your code.

    Please take a look at the attached .zip file and let me know if you have further questions.

    Greetings,
    Veronica Milcheva
    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.
  8. Ruchir
    Ruchir avatar
    10 posts
    Member since:
    Dec 2010

    Posted 13 Jan 2011 Link to this post

    Great..... Thanks Veronica.
Back to Top