Solved

VB.NET Server side Javascript

Posted on 2016-10-06
8
60 Views
Last Modified: 2016-10-14
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

0
Comment
Question by:lrbrister
8 Comments
 
LVL 78

Expert Comment

by:David Johnson, CD, MVP
ID: 41832678
Javascript has to be 'client-side' not server side.
0
 

Author Comment

by:lrbrister
ID: 41832680
Then why does the alert work?
0
 
LVL 9

Accepted Solution

by:
Karen earned 500 total points
ID: 41832837
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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 49

Expert Comment

by:Ryan Chong
ID: 41832886
I Cannot get this code to work...
need to know in what event, when and how you called that code...
0
 
LVL 9

Expert Comment

by:Karen
ID: 41836302
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
 

Author Comment

by:lrbrister
ID: 41838599
Karen
It is created in the Page Load event
0
 

Author Closing Comment

by:lrbrister
ID: 41843704
Sorry for the late get-back
Thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Angular - "nest" service calls? 18 22
Advice in Xamarin 21 56
jQuery not working on ELSE... why? 2 22
geting geocode of a user with using Google maps api 8 18
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now