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

Looking for help building a custom advancededit form

4 Answers 113 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Daniel Hodgin
Top achievements
Rank 1
Daniel Hodgin asked on 05 Apr 2010, 10:16 PM
Hello I am a college student trying out the Telerik controls for the first time for a school project

I am currently trying to add a custom advancededit template to my scheduler and im having a hard time figuring out exactly which way would be best to handle my implementation

Here is a description of how I am trying to use the scheduler

I am building a web app for a dog grooming business
Appointments contain all the standard attributes of the regular scheduler including recurrence of appointments.  I also need to add custom attributes for a client, dog, service, and groomer to the appointment.

I have columns in my appointments table for clientID, dogId, serviceId, and a guid for the groomer.

I have looked through the various examples that come packaged with the suite and I find they are either outdated or wont function exactly how I need them in my scenario

As a starting point I want to just add a drop down list in my form that contains my clients.  I have added the AdvancedForm.ascx user control and put in a radcombobox which uses an objectdatasource to get the list of all my clients and so far that works.

My appointments table allows my clients to be NULL or an int which is a foreign key to my clients table

What I cant figure out is how to add logic to select the client that is assigned to a specific appointment when I open the form in edit mode for a currently existing appointment

EX: appointment is linked with client ID 15.  when opening the appointment I want the drop down list to have the client selected that corresponds with value 15

here is a copy of my advanededit template tag.  I'm not sure exactly what "ClientID" should refer to is it a database column ?
SelectedClient is the property I have exposed in AdvancedForm.ascx.cs I believe. What exactly does '<%# Bind("ClientID") %>' mean ?

<AdvancedEditTemplate>
    <scheduler:AdvancedForm runat="server" ID="AdvancedEditForm1" Mode="Edit"
        Subject='<%# Bind("Subject") %>'
        Description='<%# Bind("Description") %>'
        Start='<%# Bind("Start") %>'
        End='<%# Bind("End") %>'
        RecurrenceRuleText='<%# Bind("RecurrenceRule") %>'
        SelectedClient='<%# Bind("ClientID") %>' />
</AdvancedEditTemplate>



My exposed property in AdvancedForm.ascx.cs looks like this:

[Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
public int SelectedClient
{
    get
    {
        if (rcbClients.SelectedIndex == 0)
            return 0;
        return Convert.ToInt32(rcbClients.SelectedValue);
    }

    set
    {
        if (value.ToString().Length == 0)
            rcbClients.SelectedIndex = 0;
        else
            rcbClients.SelectedValue = "15";
    }
}

If I make my property return an int I get a server error "Specified cast is not valid."

I assumed how this would work is my combobox would return the selected clients value as an int which would be passed to my insertAppointment method in my AppointmentList.cs class and store it in the DB.

Is using the advancededit template form the best way to do this customization ?
I tried using the resourcesTypes collection feature on the smart tag of the scheduler but i found I couldn't find a way to add logic to select the client that applies to an appointment when loading the advanced form in edit mode for an existing appointment.

I also had issues when i would choose a client but no dog or a dog and no client for example it would give me a server error about my insertAppointment method not matching.  if i selected nothing from the dropdown that property wouldn't be included in the attributes passed to my insert method

In other words i would have to write ovelroaded copies of insertAppointment for 2^n combination's of choices to handle nulls

If anyone can point me in a direction of a up to date example for Q1 2010 release i would be grateful.

The documented examples with roomid userid and colorpicker aren't detailed enough and the examples they are based off are very hard to integrate into my existing project



4 Answers, 1 is accepted

Sort by
0
Daniel Hodgin
Top achievements
Rank 1
answered on 06 Apr 2010, 04:45 AM
I have fully solved my problem and have my form working with my custom classes and attributes now

The only issue i have left is that the recurrence checkbox will properly show as checked or unchecked if the appointment recurrs but the panel to set the recurrence options does not display
0
Peter
Telerik team
answered on 08 Apr 2010, 12:21 PM
Hello Daniel,

If you are using the 2010.1.309 version, please make sure that you also use the sample from this kb article for the same version - SchedulerCustomAdvancedFormQ1_2010.zip. In particular, the AdvancedForm.js file must match the version that you are using.


Best wishes,
Peter
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
Daniel Hodgin
Top achievements
Rank 1
answered on 12 Apr 2010, 10:00 PM
im not using the AdvancedForm.js file at all.

I have a scriptmanager in my master page and I get a server error when I have 2 scriptmanager controls on the page with

<telerik:RadScriptManager runat="server" ID="RadScriptManager1">
        <scripts>
                <asp:ScriptReference Path="AdvancedForm.js" />
        </scripts>
</telerik:RadScriptManager>

I took this out and everything else works fine without it so i didn't bother using it

can i just include the .js file wilt a <script> tag instead ? or is there special 'magic' that RadScriptManager provides I need ?

Thanks for the reply
0
T. Tsonev
Telerik team
answered on 14 Apr 2010, 09:33 AM
Hi Daniel,

In this case you need to register the script in a ScriptManagerProxy:

<asp:ScriptManagerProxy runat="server" ID="ScriptManagerProxy">
        <scripts>
                <asp:ScriptReference Path="AdvancedForm.js" />
        </scripts>
</asp:ScriptManagerProxy>

I hope this helps.

Regards,
Tsvetomir Tsonev
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.
Tags
Scheduler
Asked by
Daniel Hodgin
Top achievements
Rank 1
Answers by
Daniel Hodgin
Top achievements
Rank 1
Peter
Telerik team
T. Tsonev
Telerik team
Share this question
or