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

Dynamic Resource

3 Answers 128 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
SSirica
Top achievements
Rank 3
Iron
Iron
Iron
SSirica asked on 25 Aug 2010, 05:26 PM
I have a scheduler with appointments where the resource is dependant on an aspect of the appointment.  Here is the scenario.  There are work tickets that have been assigned to different groups.  Each group has a sub set of members that it can be assigned to, essentially setting up a situation where the Resource ("Members") is dependant upon the associated action ticket Group ID.  Gettting the data is not the issue, and the "how" off adding a dynamic resource is also not the issue, what I need to know is where to put:
Dim rt As New Telerik.Web.UI.ResourceType
rt.DataSource = ds
rt.Name = "Members"
rt.ForeignKeyField = "user_id"
rt.KeyField = "user_id"
rt.TextField = "user_first"
rsWorkSch.ResourceTypes.Add(rt)

So far I've tried: .AppointmentClick, .FormCreating and .FormCreated.  In every instance the drop down is empty. 

My question is...where do I put the code to add a dynamic resource so the drop down actually contains data?

3 Answers, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 27 Aug 2010, 01:21 PM
Hello SSirica,

You need to put the code in the OnDataBound event so the resources will be added.

Please let me know if you have more questions.

All the best,
Veronica Milcheva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Craig Finnigan
Top achievements
Rank 1
answered on 26 Jan 2011, 03:39 PM
Can you provide a example of what gets added to the ondatabound event?
0
Veronica
Telerik team
answered on 31 Jan 2011, 12:32 PM
Hi Craig Finnigan,

Please accept my apologies for misleading you.

It will be too late to add resources in the OnDataBound event. The most proper is Page_Init. Here's a sample code:

protected void Page_Init(object sender, EventArgs e)
    {
        ResourceType rt = new ResourceType();
        rt.DataSource = RoomsDataSource;
        rt.Name = "Room";
        rt.ForeignKeyField = "RoomID";
        rt.KeyField = "ID";
        rt.TextField = "RoomName";
        RadScheduler1.ResourceTypes.Add(rt);
    }

ASPX:
<telerik:RadScheduler ID="RadScheduler1" runat="server" OnDataBound="RadScheduler1_DataBound"
        DataDescriptionField="Description" DataEndField="End" DataKeyField="ID" DataRecurrenceField="RecurrenceRule"
        DataRecurrenceParentKeyField="RecurrenceParentID" DataReminderField="Reminder"
        DataSourceID="SqlDataSource1" DataStartField="Start" DataSubjectField="Subject"
        EnableDescriptionField="True">
        <Reminders Enabled="True" />
        </ResourceTypes>
    </telerik:RadScheduler>
    <asp:SqlDataSource ID="RoomsDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>"
        SelectCommand="SELECT * FROM [Rooms]"></asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="SELECT * FROM [Appointments]"></asp:SqlDataSource>

Hope this helps.

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.
Tags
Scheduler
Asked by
SSirica
Top achievements
Rank 3
Iron
Iron
Iron
Answers by
Veronica
Telerik team
Craig Finnigan
Top achievements
Rank 1
Share this question
or