in
Forums
Blogs
Files
Devexpress.Com
Client Center
Support Center
DevExpress Channel

Opening a appointment with a customised menu

Last post 11/18/2008 8:30 AM by Goran Goran. 7 replies.
Page 1 of 1 (8 items)
Sort Posts:
Previous Next
  • 6/17/2008 3:16 AM

    Opening a appointment with a customised menu

    hi,

     

    Im trying to open an appointment with a customised menu. I looked in the help file but I can't seem to find how to do this. I basicly used the example of the website ( PreparePopupMenu ). ATM this is what i got:

     protected void DocentRooster_PreparePopupMenu(object sender, PreparePopupMenuEventArgs e)
    {
     ASPxSchedulerPopupMenu menu = e.Menu;
     DevExpress.Web.ASPxMenu.MenuItemCollection menuItems = menu.Items;
     if (menu.Id.Equals(SchedulerMenuItemId.DefaultMenu))
     {
     }
     else if (menu.Id.Equals(SchedulerMenuItemId.AppointmentMenu))
     {
      menu.ClientSideEvents.ItemClick = String.Format("function(s, e) {{ DefaultAppointmentMenuHandler({0}, s, e); }}", DocentRooster.ClientID);
      menu.Items.Clear();
        
      DevExpress.Web.ASPxMenu.MenuItem registreerItem = new DevExpress.Web.ASPxMenu.MenuItem("Registreer presentie", "RegistreerPresentieID");
      registreerItem.NavigateUrl = "~/Forms/Presentieregistratie.aspx";
      registreerItem.BeginGroup = true;
      menuItems.Add(registreerItem);
      DevExpress.Web.ASPxMenu.MenuItem openItem = new DevExpress.Web.ASPxMenu.MenuItem("Open", "OpenID");
      openItem.BeginGroup = true;
      menuItems.Add(openItem);
      DevExpress.Web.ASPxMenu.MenuItem deleteItem = new DevExpress.Web.ASPxMenu.MenuItem("Verwijder", "DeleteId");
      menuItems.Add(deleteItem);
     }
    }

    So I have an openItem, with an "OpenID" assigned to it. When I click on it I will break in the ExecuteCore() like this:

     protected override void ExecuteCore()

     Appointment apt = Control.SelectedAppointments[0];   
     if (MenuItemId == "DeleteId")
     {
      apt.Delete();
     }
     else if (MenuItemId == "RegistreerPresentieID")
     {
      System.Web.UI.Page pPage = this.Control.Parent.Page;
      zetAppointment(apt, ref pPage);
     }
     else if (MenuItemId == "OpenID")
     {
      System.Web.UI.Page pPage = this.Control.Parent.Page;
     }
    }

     

    My problem starts here, how do I invoke the appointment form?

    Could you give me a hint?

    With kind regards,

    Dario Leanza

    Van Ooijen Consultancy

     

  • 6/17/2008 6:35 AM In reply to

    Re: Opening a appointment with a customised menu

     Even this wont work, the page will be immidiately called when I click on the Menu item. This way I cant find the appointment.

    How can I pass variables to the page called? In my case: registreerItem.NavigateUrl = "~/Forms/Presentieregistratie.aspx";

    I want to pass the selected appointment on the scheduler to that page.

     

  • 7/27/2008 9:00 PM In reply to

    Re: Opening a appointment with a customised menu

     I have the same issue.  Did you manage to find a solution tot his?

  • 7/28/2008 5:40 AM In reply to

    Re: Opening a appointment with a customised menu

    I used a script to browse to another page. I used window.location in the javascript.

    What i do is the following, when a user selects an item in the scheduler I fill my iAppointmentID with a script. Then when the user right clicks and selects Open appointment the following script will be called: OnGetAppointmentProps(). This will do a redirect to my new page with the appointmentID parameter.

    Please feel free to ask again :)

    <script language="javascript" type="text/javascript">
     var iAppointmentID = 0;
     
     function OnGetAppointmentProps()
     {
      window.location="Presentieregistratie.aspx?RoosterID=" + iAppointmentID; 
     }
     function OnAppointmentsSelectionChanged(scheduler, appointmentIds) {
      if (appointmentIds != null && appointmentIds.length == 1)
      {
       iAppointmentID = appointmentIds[0];
      }
      else
      {
       iAppointmentID = 0;
      }
     }
     function DefaultAppointmentMenuHandler(scheduler, s, args)
     {
      if (args.item.name == "ModifyId")
      {
       scheduler.RaiseCallback("MNUAPT|OpenAppointment");
      }
      if (args.item.name == "OpenId")
          OnGetAppointmentProps();
      if (args.item.name == "NewId")
        scheduler.RaiseCallback("MNUAPT|NewAppointment");
      if (args.item.GetItemCount() <= 0)
        scheduler.RaiseCallback("USRAPTMENU|" + args.item.name);
     }
     </script>

  • 7/28/2008 10:49 PM In reply to

    Re: Opening a appointment with a customised menu

     Many thanks for your help Dario!  I actually needed to pass in the date of the current date selection rather than appointment Ids.  I borrowed from your idea and have coded the following solution:

    <ClientSideEvents SelectionChanged="function(s,e){currentDt=s.selection.firstSelectedInterval.GetStart();}" />

    and the following JS:


    <script type="text/javascript">

    var currentDt;

    function OnGetCurriculumPlanProps()

    {

    window.location="MyPlan.aspx?dtStart=" + currentDt;

    }


    function DefaultAppointmentMenuHandler(scheduler, s, args)
    {

    if (args.item.name == "CurriculumPlanId")

    OnGetCurriculumPlanProps();

    }


    </script>

    This appears to work OK.  It's a shame that the product doesn't provide more support for integration with developers custom forms.  I try to stay away from using the products own appointment forms and custom templates as I find them to be really slow.  The standard appointment form running in IE 6 seems to take ages to activate.  My own form (which is activated by a custom menu) takes a fraction of the time to activate.

    Regards

    Myles Johnson

     

     

     

     

     

     

  • 10/2/2008 6:44 PM In reply to

    • Kali
    • Not Ranked
    • Joined on 10/2/2008
    • Posts 1

    Re: Opening a appointment with a customised menu

    Thank you so much for the direction on this.  This is exactly what I need to do.  I'm new to ASP.net and JavaScript, so I'm trying hard to understand how to implement your solution.  Thanks in advance for being elementary with me.  What does your <Client Side Events> section look like?  I'm not sure how to make that event (SelectionChanged) fire one of the JavaScript functions you've detailed in your post.  Again, thank you.

  • 11/18/2008 8:30 AM In reply to

    Re: Opening a appointment with a customised menu

    I do prety much the same

     

     

    <

     

    ClientSideEvents AppointmentsSelectionChanged="function(s, e) {

    if (e.appointmentIds != null &amp;&amp; e.appointmentIds.length == 1){

    newpage = window.open('Remark.aspx?FORM_ID=' + e.appointmentIds[0],'blank');

    setFocus2(newpage);

    }

    }"

     

     

     

    />

    the think is i open new page but the page that has ASPxScheduler it is opend. The problem is that when i change views the page is opened again, like the AppointmentsSelectionChanged event is raised again.

    pls help

    regards,

    Goran

  • 11/18/2008 8:30 AM In reply to

    Re: Opening a appointment with a customised menu

    I do prety much the same

     

     

    <

     

    ClientSideEvents AppointmentsSelectionChanged="function(s, e) {

    if (e.appointmentIds != null &amp;&amp; e.appointmentIds.length == 1){

    newpage = window.open('Remark.aspx?FORM_ID=' + e.appointmentIds[0],'blank');

    setFocus2(newpage);

    }

    }"

     

     

     

    />

    the think is i open new page but the page that has ASPxScheduler it is opend. The problem is that when i change views the page is opened again, like the AppointmentsSelectionChanged event is raised again.

    pls help

    regards,

    Goran

Page 1 of 1 (8 items)
Copyright © 1998-2008 Developer Express Inc.
ALL RIGHTS RESERVED