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

[Solved] find controls in template

5 Answers 164 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Nate
Top achievements
Rank 1
Nate asked on 16 Feb 2008, 12:11 AM
Probably an easy question for somebody.. 

from event: RadScheduler2_AppointmentCreated
I am able to use e.Container.FindControl to get at my own asp:hidden cntrls inside an AppointmentTemplate
 
How can I get at those cntrls inside the event:
RadScheduler2_AppointmentInsert(object sender, SchedulerCancelEventArgs e)

Nice if there were an easier way to do this but basically I am making a db trip for every appointment and filling hiddens with extra data I would like to associate with the appointment. That way on the update or insert I can do my own ins/update to the db and add in those extra items. I take it the only other way to get the functionality I want would be to write my own provider??
Please at least answer the how to get at the hidden cntrls question above if you can.

Thanks.

5 Answers, 1 is accepted

Sort by
0
Wade Leveille
Top achievements
Rank 1
answered on 16 Feb 2008, 01:05 AM
I found this solution when I had the same problem.  You should handle your updating and inserting in the event AppointmentCommand.  Here's an example:

protected void RadScdler_AppointmentCommand(object sender, Telerik.Web.UI.AppointmentCommandEventArgs e)
{
 if (e.CommandName == "Insert")
 {
  /* handle insert of event into database */

  HiddenField hf = e.Container.FindControl("MyHiddenField") as HiddenField;
               
  /***** Do DB Insert Here **********/
        }
        else if (e.CommandName == "Update")
        {
  /* handle update of event in database */

  HiddenField hf = e.Container.FindControl("MyHiddenField") as HiddenField;
               
  /***** Do DB Update Here **********/
        }

}

0
Nate
Top achievements
Rank 1
answered on 19 Feb 2008, 05:14 PM
That would be nice but.. for example if I go into "week view" and then try to drag the appointment to lengthen the time span, the AppointmentCommand function is never fired. 

RadScheduler2_AppointmentUpdate   is actually what gets fired and I don't know how to get at my hidden controls from inside that function.

0
Peter
Telerik team
answered on 19 Feb 2008, 05:21 PM
Hi Nathan,

You could use the FormCreated event:
protected void RadScheduler1_FormCreated(object sender, Telerik.Web.UI.SchedulerFormCreatedEventArgs e)  
    {  
 
    } 

I hope this helps.


Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Nate
Top achievements
Rank 1
answered on 19 Feb 2008, 06:36 PM
Why would that work? Peter, please read my last post again. I don't think that your suggested function will even fire in that case.
0
Dimitar Milushev
Telerik team
answered on 21 Feb 2008, 10:37 AM
Hi Nate,

I would recommend you to use Scheduler's Custom Attributes to associate additional data with appointments. You can see an example at http://www.telerik.com/demos/aspnet/prometheus/Scheduler/Examples/CustomAttributes/DefaultCS.aspx

Please, let us know if you this approach isn't suitable for your scenario.

Best wishes,
Dimitar Milushev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Scheduler
Asked by
Nate
Top achievements
Rank 1
Answers by
Wade Leveille
Top achievements
Rank 1
Nate
Top achievements
Rank 1
Peter
Telerik team
Dimitar Milushev
Telerik team
Share this question
or