Solved

VB.NET Server side Javascript

Posted on 2016-10-06
8
51 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
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…

747 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

12 Experts available now in Live!

Get 1:1 Help Now