Launch HTML page from scheduler new event

I would like to launch an HTML page after a new scheduler event has been created. Where would I insert the code for this? Would it be in the .aspx file and if so, where?
I am using the ASP.Net version of the scheduler.

Hi,
it can be done with the client-side code. You can add following code after DHXScheduler.Render. Or trigger it from DHXScheduler.AfterInitscheduler.dataProcessor.attachEvent("onAfterUpdate", function(sid, mode, tid){ if(mode == "inserted"){ window.open("someUrl?id="+ tid;);//or change location of current page }; return true; });
docs.dhtmlx.com/api__dataprocess … event.html

Aleksandr,
I don’t have a block of code in my Index.aspx like that. However, I have a block that looks like this:
scheduler.attachEvent(“onEventCreated”, function(event_id){
var ev = scheduler.getEvent(event_id);
if (ev.start_date < new Date()){
scheduler.deleteEvent(event_id, true);
} else {
ev.user_id = scheduler._user_id;
ev.textColor = scheduler._color;
return true;
}

Would I insert your “if” block just before the “return true” line?

Hi,
try to add the code from my previous answer to the page.
“onAfterUpdate” is triggered each time event had been saved to the server, and server has returned a correct response. The checking (mode == “inserver”) is needed to call custom logic only when new event has been added (not updated or deleted).

Try simply adding this code in a script tag after DHXScheduler.Render();, e.g.[code]


<%= Scheduler.Render() %>
[/code]

If the server-side saving return correct response, the code will redirect user to another page, and event id will be available in a query string

Aleksandr,
I used your suggestion but the event didn’t appear to fire. I am listing the code inside my index.aspx. The code in use is from the room booking sample available at the time of the release. The code snippet I inserted is near the end of the block.

	    <script type="text/javascript">

	        function init() { 
		//store name of user in js var
		        <% if(Request.IsAuthenticated){ %>
	    	        scheduler._user_id = "<%= Model.User.UserId %>";

		        <%} %>
		        //block all operations for not authenticated user
		        scheduler.config.readonly = <%= Request.IsAuthenticated ? "false" : "true" %>;

                //-->> 
                //scheduler.Extensions.Add(SchedulerExtensions.Extension.ActiveLinks);
                //scheduler.BeforeInit.Add(string.Format("scheduler.config.active_link_view = \"{0}\";", roomView.Name));

                //visual settings
	            //scheduler.config.first_hour = 8;
                //scheduler.config.last_hour = 18;
                
                scheduler.locale.labels.units_tab = 'Sims';
                scheduler.locale.labels.section_room = "Sim:";
                scheduler.config.multi_day = true;
                // Fix time slot to 1 hour on the hour
                scheduler.config.time_step = 60;  

                //custom event text
                function template(start,end,ev){
                    return getRoom(ev.room_id) + " : " + ev.text;
                }
                scheduler.templates.event_text = template;
                scheduler.templates.agenda_text = template;
                scheduler.templates.event_bar_text = template;
                scheduler.templates.week_agenda_event_text = function(start_date, end_date, event, date) {
	                return scheduler.templates.event_date(start_date) + " " + template(start_date, end_date, event);
                };

                //list of rooms
                var rooms = [<% for(var i =0; i < Model.Rooms.Count; i++){ %>
                     {key:<%= Model.Rooms[i].room_id %>, label:"<%= Html.Encode(Model.Rooms[i].title) %>"}<%= i<Model.Rooms.Count-1 ? "," : "" %>   
                <% } %>];
                //helper, returns room name by id
                function getRoom(id){
                    for(var i in rooms){
                        if(rooms[i].key == id)
                            return rooms[i].label;
                    }
                }

                //units view
	            scheduler.createUnitsView({ 
                    "name": "units",
                    "list": rooms,                     
                    "property": "room_id" 
                });
                
                //lightbox configuration
                scheduler.config.lightbox.sections = [
                    {name:"description",height:200,map_to:"text",type:"textarea",focus:!0},
                    {name:"room",map_to:"room_id",type:"select",options:rooms},
                    {name:"time",height:72,type:"time",map_to:"auto"}             
                ];


		        //check is event belongs to the user and is it not started yet
		        var isEditable = function(event_id){
			        var ev = scheduler.getEvent(event_id);
	    	        return (ev && ev.start_date > new Date() && ev.user_id == scheduler._user_id);
		        };
		        //block operations for not owned events
		        scheduler.attachEvent("onBeforeLightbox", isEditable);
		        scheduler.attachEvent("onBeforeDrag", isEditable);
		        scheduler.attachEvent("onClick", isEditable);
		        scheduler.attachEvent("onDblClick",isEditable);      
		        //each time as new event created - assign user, color and room to it
		        scheduler.attachEvent("onEventCreated", function(event_id){
			        var ev = scheduler.getEvent(event_id);
		            if (ev.start_date < new Date()){
				        scheduler.deleteEvent(event_id, true);
		            } else {
		                ev.user_id = scheduler._user_id;
		                ev.textColor = scheduler._color;
                        //if(mode == "inserted"){
                        //window.open("../pages/PayPalSIM1.htm");//or change location of current page
                        //};
                        return true;    
		           }

                scheduler.attachEvent("onAfterUpdate"), function(sid, mode, tid){
                if(mode == "inserted"){
                    window.open("../pages/PayPalSIM1.htm");
                return true;
                   }
                }
		        });


                //Date setup
                var myDate=new Date();
                myDate.setDate(myDate.getDate());

                //data loading
	            scheduler.config.xml_date = "%m/%d/%Y %H:%i";
	            //scheduler.init("scheduler_here", new Date(2011, 8, 9), "month");
                //scheduler.init("scheduler_here", myDate, "week");
                scheduler.init("scheduler_here", myDate, "units");
	            scheduler.load("/Calendar/Data");

                //data saving
	            var dp = new dataProcessor("/Calendar/Save");
	            dp.init(scheduler);
	            dp.setTransactionMode("POST", false);
	        }
	    </script>

The namespace path you posted is not found in my sample code so I adapted it by removing the middle element. Perhaps you have a suggestion on how I can adapt the code.

Thanks,
Merv

Hello,
please check the demo, here is a download link
s3.amazonaws.com/uploads.hipcha … ng_air.zip

when you launch application

  1. click login at top right
  2. sign in with one of predefined accounts
  3. create appointment
    after appointment is created, you’ll be redirected to the new page. New code can be found in scripts.js, line 126

I’ve modified this room booking example
blog.scheduler-net.com/post/Room … vents.aspx