Javascript window.open event causes parent window to display [object]

Good evening,

I have the code section # 1 setting an onclick event for a ASP.NET calendar control in its render event.  The javascript runs fine.  But, upon opening the second window, the parent changes to a blank screen displaying the text "[object]".  I've attached an image of the page.  Does anyone know the solution to fix this?

Thank you in advance.
Section # 1:
e.Cell.Text = "<a href=javascript:window.open('http://www.website.com/detail.aspx?locationid=" & ddl1.SelectedValue & "&datevar=" & e.Day.Date & "','newwindow',width=825) style=color:#5195CE>" & e.Day.DayNumberText & "</a>"

Open in new window

Error1.JPG
LVL 9
divinewind80Asked:
Who is Participating?
 
objectsCommented:
try:

<a href="#" onClick="javascript:....
0
 
objectsCommented:
is the url of the loaded page as expected
check it in firefox with firebug to see the cause of the error

0
 
divinewind80Author Commented:
Yes, it appears correctly.  Just to be clear, the pop-up window is loading perfectly.  At the moment it loads, though, the parent page goes blank.

I will try out the Firefox with Firebug solution.

Let me know if anyone else has any ideas.

Thanks.
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
sunithnairCommented:
Do any of the following and see if it works
e.Cell.Text = "<a href='javascript:window.open(""http://www.website.com/detail.aspx?locationid=" & ddl1.SelectedValue & "&datevar=" & e.Day.Date & """,""newwindow"",""width=825"")' style=color:#5195CE>" & e.Day.DayNumberText & "</a>"
 
or
 
e.Cell.Text = "<a href="#" onclick='javascript:window.open(""http://www.website.com/detail.aspx?locationid=" & ddl1.SelectedValue & "&datevar=" & e.Day.Date & """,""newwindow"",""width=825"")' style=color:#5195CE>" & e.Day.DayNumberText & "</a>"

Open in new window

0
 
sunithnairCommented:
sorry this
e.Cell.Text = "<a href='javascript:window.open(""http://www.website.com/detail.aspx?locationid=" & ddl1.SelectedValue & "&datevar=" & e.Day.Date & """,""newwindow"",""width=825"")' style=color:#5195CE>" & e.Day.DayNumberText & "</a>"
 
or
 
e.Cell.Text = "<a href='#' onclick='javascript:window.open(""http://www.website.com/detail.aspx?locationid=" & ddl1.SelectedValue & "&datevar=" & e.Day.Date & """,""newwindow"",""width=825"")' style=color:#5195CE>" & e.Day.DayNumberText & "</a>"

Open in new window

0
 
sunithnairCommented:
Try to put style also in quotes
e.Cell.Text = "<a href='javascript:window.open(""http://www.website.com/detail.aspx?locationid=" & ddl1.SelectedValue & "&datevar=" & e.Day.Date & """,""newwindow"",""width=825"")' style='color:#5195CE'>" & e.Day.DayNumberText & "</a>"
 
or
 
e.Cell.Text = "<a href='#' onclick='javascript:window.open(""http://www.website.com/detail.aspx?locationid=" & ddl1.SelectedValue & "&datevar=" & e.Day.Date & """,""newwindow"",""width=825"")' style='color:#5195CE'>" & e.Day.DayNumberText & "</a>"

Open in new window

0
 
divinewind80Author Commented:
Seems like the "#" idea worked.  Thank you very much.  Any ideas what caused this to happen in the first place?
0
 
sunithnairCommented:
You did not have the proper quotes opening and closing i suppose. You can also try adding a return false statement in the end like this
e.Cell.Text = "<a href='javascript:window.open(""http://www.website.com/detail.aspx?locationid=" & ddl1.SelectedValue & "&datevar=" & e.Day.Date & """,""newwindow"",""width=825""); return false;' style='color:#5195CE'>" & e.Day.DayNumberText & "</a>"
 
or
 
e.Cell.Text = "<a href='#' onclick='javascript:window.open(""http://www.website.com/detail.aspx?locationid=" & ddl1.SelectedValue & "&datevar=" & e.Day.Date & """,""newwindow"",""width=825""); return false;' style='color:#5195CE'>" & e.Day.DayNumberText & "</a>"

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.