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

Scheduler / Resource Availability GroupBy not Working

7 Answers 126 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Ruchir
Top achievements
Rank 1
Ruchir asked on 11 Jan 2011, 03:25 PM
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

7 Answers, 1 is accepted

Sort by
0
Ruchir
Top achievements
Rank 1
answered on 12 Jan 2011, 08:39 AM
Can anyone help ?
0
Veronica
Telerik team
answered on 12 Jan 2011, 09:52 AM
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.
0
Ruchir
Top achievements
Rank 1
answered on 12 Jan 2011, 10:37 AM
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.
0
Ruchir
Top achievements
Rank 1
answered on 12 Jan 2011, 03:22 PM
Hi Veronica,
   Still no reply from your side ???
  
Thanks,
Ruchir.  
0
Ruchir
Top achievements
Rank 1
answered on 13 Jan 2011, 08:06 AM
Hi Veronica,
    Can you help ?



Thanks,
Ruchir
0
Accepted
Veronica
Telerik team
answered on 13 Jan 2011, 01:49 PM
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.
0
Ruchir
Top achievements
Rank 1
answered on 13 Jan 2011, 02:09 PM
Great..... Thanks Veronica.
Tags
Scheduler
Asked by
Ruchir
Top achievements
Rank 1
Answers by
Ruchir
Top achievements
Rank 1
Veronica
Telerik team
Share this question
or