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

ResourceType insert

12 Answers 127 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Rubihno
Top achievements
Rank 1
Rubihno asked on 25 Sep 2008, 07:06 AM
Hi,

In my project i have a treview asp.net 2.0 populate with a classroom, when i select node classroom my scheduler filter with a classroom selected, when i select a node i save in session the classroom, in insert mode to scheduler i have a resourcetype(Dropdownlist) classroom, i select a classroom to dropdownlist and i insert a reservation, but i have all classroom into a resourtype, how i make when i make douple click on scheduler have automatically at first position in resourtype a node selected on treeview? I use a customadvancedTemplate....

Hi

Table Reservation(Appointment)

Subject
Start
End
Recurrence_rule
Data_Storga
Classroom_ID

Table Classroom

Classroom_ID
Classroom_Name

12 Answers, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 26 Sep 2008, 10:20 AM
Hello Rubihno,

Could you clarify a bit more on your configuration? Which control do you use to select the Classroom resource? Where is the TreeView located?

Please provide more information, so that we can give you an adequate suggestion.

Regards,
Simon
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Rubihno
Top achievements
Rank 1
answered on 26 Sep 2008, 01:05 PM

Into a page reservation.aspx i have this configuration:

1. Treeview Classroom populate with Dataset,DataRow(table Classroom), classroom node -> ID_Classroom ->  i save in session("Classroom") the selectetvalue node selected

2. I have radscheduler that works with sqldatasource Reservation (i use a customadvancedtemplate)

3. In sqldatasourceReservation selectquery, i have set a Treeview clause where ID_Classroom, when i select a node, the scheduler filter the reservation by classroom

4. Into a scheduler(resourcecontrol.ascx) i have a dropdownlist Classroom(resourtype), when i insert a new reservation i select the value on dropdown, but how i make to select automatically value that is save in session("Classroom")?, i would that first value of dropdown is the session("classroom"), in insertmode..when i select a node on treeview...
0
Simon
Telerik team
answered on 29 Sep 2008, 12:25 PM
Hello Rubihno,

You can handle the FormCreated event and check whether the form that is created is the advanced insert one. In this case, you can find the DropDownList and select the desired Classroom value.

Please see a sample implementation of this approach here.

Regards,
Simon
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Rubihno
Top achievements
Rank 1
answered on 30 Sep 2008, 11:01 AM
thanks but don't run

I have a  resourytype(dropDownList) name="Classroom"

When i selecnode on treeview i save in session("Classroom") the node.text selected

Now i use this code for save in fisrt position into a dropdownlist the session("Classroom") when i make double click on scheduler in mode insert...

 
 Protected Sub RadScheduler1_FormCreated(ByVal sender As Object, ByVal e As SchedulerFormCreatedEventArgs) Handles RadScheduler1.FormCreated 
 
 
        If e.Container.Mode = SchedulerFormMode.Insert Then 
 
            Dim ClassRoomInsert As DropDownList = CType(e.Container.FindControl("ClassRoom"), DropDownList) 
            auleInsert.SelectedValue = Session("ClassRoom") 
 
 
        End If 

I tried but the dropdownlist is not selected on session that i have set...
0
T. Tsonev
Telerik team
answered on 30 Sep 2008, 04:09 PM
Hello Rubihno,

Everything seems correct in you code, except that you need to check for AdvancedInsert, instead of Insert:

Protected Sub RadScheduler1_FormCreated(ByVal sender As ObjectByVal e As SchedulerFormCreatedEventArgs) Handles RadScheduler1.FormCreated  
  
  
        If e.Container.Mode = SchedulerFormMode.AdvancedInsert Then  

In this case Insert is used for the inline insert form. Let us know how this goes.

Kind regards,
Tsvetomir Tsonev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Rubihno
Top achievements
Rank 1
answered on 01 Oct 2008, 02:12 PM
This is my code, but don't runs

Protected Sub RadScheduler1_FormCreated(ByVal sender As Object, ByVal e As SchedulerFormCreatedEventArgs) Handles RadScheduler1.FormCreated



        If e.Container.Mode = SchedulerFormMode.Insert Then

            Dim auleInsert As DropDownList = CType(e.Container.FindControl("Aule"), DropDownList)
            auleInsert.SelectedValue = Session("AulaIDSelezionata")

        End If

    End Sub

The first value on resource type Classroom is     " - " on scheduler.advancedinsert
0
T. Tsonev
Telerik team
answered on 01 Oct 2008, 04:34 PM
Hi Rubihno,

Try replacing it with:

 
Protected Sub RadScheduler1_FormCreated(ByVal sender As ObjectByVal e As SchedulerFormCreatedEventArgs) Handles RadScheduler1.FormCreated 
        If e.Container.Mode = SchedulerFormMode.AdvancedInsert Then 
 
            Dim auleInsert As DropDownList = CType(e.Container.FindControl("Aule"), DropDownList) 
            auleInsert.SelectedValue = Session("AulaIDSelezionata"
 
        End If 
 
    End Sub 

Note the different "if" clause. Let us know how this goes.

Sincerely yours,
Tsvetomir Tsonev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Rubihno
Top achievements
Rank 1
answered on 01 Oct 2008, 06:04 PM
thanks, but don't run..

error code:

auleInsert.SelectedValue = Session("AulaIDSelezionata")
->
Object reference not set to an instance of an object.

Why? the name of resourctype ClassRoom is "Aule" and the session run
0
Rubihno
Top achievements
Rank 1
answered on 01 Oct 2008, 06:12 PM
I use a customAdvancedTemplate, with user-control...
0
T. Tsonev
Telerik team
answered on 03 Oct 2008, 04:00 PM
Hello Rubihno,

It looks like the the ID of the drop-down is not quite the same. I have just realized that we work around the problem, by assigning the resource directly to the appointment in the FormCreating event:

Protected Sub RadScheduler1_FormCreating(ByVal sender As ObjectByVal e As SchedulerFormCreatingEventArgs) Handles RadScheduler1.FormCreating 
    If e.Mode = SchedulerFormMode.AdvancedInsert Then 
        Dim selectedResource As Resource = RadScheduler1.Resources.GetResource("Aule", Session("AulaIDSelezionata")) 
        e.Appointment.Resources.Add(selectedResource) 
    End If  
End Sub  

This should preselect the resource. Let us know if you still have any problems.

Kind regards,
Tsvetomir Tsonev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Rubihno
Top achievements
Rank 1
answered on 05 Oct 2008, 02:27 PM
I tried this code solution but don't run, i try to attached the project problem on support ticket...for resolve a problem..
0
Rubihno
Top achievements
Rank 1
answered on 06 Oct 2008, 07:08 AM
the code run in Form_Created and the value into a variable selectedResource  is "A-12", but in mode schedulerformode advancedinsert, the resource dropdownlist "Aule" the value selected is -> " - " and not "A-12"....
Tags
Scheduler
Asked by
Rubihno
Top achievements
Rank 1
Answers by
Simon
Telerik team
Rubihno
Top achievements
Rank 1
T. Tsonev
Telerik team
Share this question
or