search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Postback Events And Free Time EventHandler help

Asked by Gareth
17 years ago.
Please can you tell me the statements for clicking on a free time bit and an event
For example the below code will redirect the user to a different page if an event history exists
protectedvoid DayPilotCalendar1_EventClick(object sender, EventArgs e)
{
Response.Redirect("ViewEvents.aspx");
}
What would be the same eventhandler if no event existing so I can redirect them to a NewEvevnts.aspx page. I have written part of it below but please fill the bit in with the question mark
protectedvoid DayPilotCalendar1_??????????????????????(object sender, EventArgs e)
{
Response.Redirect(NewEvents.aspx");
}
Thanks
Gareth
Comment posted by Dan Letecky
17 years ago.
This event is called TimeRangeSelected. If you double-click that event in Visual Studio designer (Properties window) it will create a new handler, e.g.

protected void DayPilotCalendar1_TimeRangeSelected(object sender, TimeRangeSelectedEventArgs e) {
}

The "e" argument contains information about the range selected:
e.Start
e.End
e.ColumnId
Comment posted by Gareth
17 years ago.

protected void DayPilotCalendar1_TimeRangeSelected(object sender, TimeRangeSelectedEventArgs e) {
}
Doesnt like the bit in BOLD

Error = "Error1The type or namespace name 'TimeRangeSelectedEventArgs' could not be found (are you missing a using directive or an assembly reference?)"

Am using Visual Web Developer. C# ASP.net (Obviously :) )

Comment posted by Dan Letecky
17 years ago.
Try replacing it with DayPilot.Web.Ui.Events.TimeRangeSelectedEventArgs.

However, the easiest way to generate the event handler is to double-click the TimeRangeSelected event in Visual Studio (or VWD). You will find it in the "Properties" windows in the lower-right corner of the main window. You need to switch to "Events" view using the orange flash in the Properties window toolbar.

If you have TimeRangeSelectedEventArgs in the method header instead of EventArgs you can access its properties (e.ColumnId, e.Start, e.End...).
Comment posted by Gareth
17 years ago.

Still does not work. I agree when you double click on controls they normall create the header for you but i double click on it all that happens is the code window opens, is doesnt actually create an eventclick header??

Im using Visual Webdevloper by the way.

Gareth

ps. Sorry to be a pain

Comment posted by Dan Letecky
17 years ago.
OK. I'll give it a try in VWD.
Comment posted by Gareth
17 years ago.

Yep that has been tested and the same problem.

How did u get on with your test?

Comment posted by Dan Letecky
17 years ago.

OK. It seems to be working for me.My steps:

1. I've extracted DayPilotProTrial-3.5.2.zip/Binary/DayPilot.dll into c:\components\daypilot-3.5-trial

2. I've opened VWD and created a new web site in the filesystem.

3. I've added DayPilot (c:\components\daypilot-3.5-trial\daypilot.dll) to the toolbox according to http://www.daypilot.org/installation.html.

4. I dragged DayPilotCalendar from the toolbox to Default.aspx in the design mode.

5. I double-clicked TimeRangeSelected event in the properties window. The following code was created:

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void DayPilotCalendar1_TimeRangeSelected(object sender, DayPilot.Web.Ui.Events.TimeRangeSelectedEventArgs e)
{

}
}

6. I've changed TimeRangeSelectedHandling to PostBack.

7. I've added a new Label control to the page and changed the DayPilotCalendar1_TimeRangeSelected method as follows:

protected void DayPilotCalendar1_TimeRangeSelected(object sender, DayPilot.Web.Ui.Events.TimeRangeSelectedEventArgs e)
{
Label1.Text = e.Start.ToString();
}

8. Pressed F5 and it works.

Comment posted by Gareth
16 years ago.
Thanks Dan. Much Appreciated
This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.