VB.NET Server side Javascript

I have a sub and on load I can get this to work...
ScriptManager.RegisterStartupScript(Me, [GetType](), "alertMessage", "alert('LBRISTER');", True)

However....
I Cannot get this code to work...
What am I missing?

Dim url As String = "return window.radopen('EmployeeContact.aspx?MyLeads=1&ispop=1&IndividualID=1&CampaignID=0&OriginID=0&IsPopup=1','ViewContact');"
ScriptManager.RegisterStartupScript(Me, [GetType](), "script", url, True)

Open in new window



That string above works when assigned as an attribute in a RadGrid...
DirectCast(dataItem.FindControl("LinkName"), HyperLink).Attributes("onclick") = "return window.radopen('EmployeeContact.aspx?MyLeads=1&ispop=1&IndividualID=" & IndividualID & "&CampaignID=" & CampaignID & "&OriginID=" & OriginID & "&IsPopup=1" & "','ViewContact');"

Open in new window

Larry Bristersr. DeveloperAsked:
Who is Participating?
 
KarenConnect With a Mentor Analyst programmerCommented:
Well my guess is that you are trying to open a new window just in javascript, instead of getting the user to trigger it by clicking on something. Browsers and security settings usually stop that sort of thing.
0
 
David Johnson, CD, MVPOwnerCommented:
Javascript has to be 'client-side' not server side.
0
 
Larry Bristersr. DeveloperAuthor Commented:
Then why does the alert work?
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
Ryan ChongCommented:
I Cannot get this code to work...
need to know in what event, when and how you called that code...
0
 
KarenAnalyst programmerCommented:
Dim url As String = "return window.radopen('EmployeeContact.aspx?MyLeads=1&ispop=1&IndividualID=1&CampaignID=0&OriginID=0&IsPopup=1','ViewContact');"
ScriptManager.RegisterStartupScript(Me, [GetType](), "script", url, True)

Open in new window


how does this code get added to the page? Is it triggered by a user clicking on a button?
0
 
Larry Bristersr. DeveloperAuthor Commented:
Karen
It is created in the Page Load event
0
 
Larry Bristersr. DeveloperAuthor Commented:
Sorry for the late get-back
Thanks
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.