Link to home
Start Free TrialLog in
Avatar of Larry Brister
Larry BristerFlag for United States of America

asked on

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

Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

Javascript has to be 'client-side' not server side.
Avatar of Larry Brister

ASKER

Then why does the alert work?
ASKER CERTIFIED SOLUTION
Avatar of Karen
Karen
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I Cannot get this code to work...
need to know in what event, when and how you called that code...
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?
Karen
It is created in the Page Load event
Sorry for the late get-back
Thanks