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

Open a new window using window.open

Asked by Anonymous
13 years ago.

I use contextmenu to print a report.

I test the command of DayPilotScheduler1_EventMenuClick which is "print"

I want to open a new form and i use (which works with other page in vb.net)

"<script language=" + Chr(34) + "javascript" + Chr(34) + ">window.open('" + sUrl + "','" + sW + "');</script>"

nothings displays, no window opens.

Have you a solution ?

Comment posted by Dan Letecky
13 years ago.

You could try something like this:

<DayPilot:MenuItem Text="Open" Action="JavaScript" JavaScript="window.open('Details.aspx?id={0}', 'windowname')" ></DayPilot:MenuItem>

Where {0} will be replaced by the event id.

Or:

<DayPilot:MenuItem Text="Open" Action="JavaScript" JavaScript="window.open('Details.aspx?id=' + e.value(), 'windowname')" ></DayPilot:MenuItem>

Where e holds the client-side DayPilot.Event object.

Comment posted by Anonymous
13 years ago.

I can't use this because when i go to the print command i make a lot of things and after i must open a new window witch contain the report ...

Comment posted by Dan Letecky
13 years ago.

Then, if you are using CallBack for invoking EventMenuClick, you can pass custom instructions using Update() and use it in AfterRenderJavaScript:

EventMenuClick handler:

Hashtable result = new Hashtable();
result["url"] = "YourUrl.aspx?id=something";
result["window"] = "windowname";
DayPilotCalendar1.Update(result); // or see the other signatures

AfterRender handler:

AfterRenderJavaScript="if (data && data.url && data.window) { window.open(data.url, data.window); };"
Comment posted by Anonymous
13 years ago.

Thnaks for yourquick answer.

That works.

But i use AfterRenderJavaScript for display the warm message. As a result, the message does not display any more ...

I am sure that it is possible to do the function at the same time.

Comment posted by Anonymous
13 years ago.

LOL

I found the solution ...

AfterRenderJavaScript="if (data && data.url && data.window) { window.open(data.url, data.window); }else{afterRender(data)};"

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.