Link to home
Start Free TrialLog in
Avatar of wilcor14
wilcor14Flag for United States of America

asked on

open link from popup in original page transfering a parameter established in the code behind

Not sure if this should be posted in the ASP.net section but we'll see.

A popup is opened from a "main" page. Then a link is clicked from the popup that should be opened in the "main" page and a parameter (sUserID) needs to be sent to the "main" page that was established in the codebehind in the popup window. The link in the popup was created in the code behind. So far, this is what I have:

In the popup:
sLink = "<a href='#' onclick='opener.location.href='forum/searchpro.aspx?author=" & sUserID & "&top=50';window.close();return false;'>Newest 50</a>"

lblPosts.Text = sLink

Thanks in advance.
ASKER CERTIFIED SOLUTION
Avatar of Zvonko
Zvonko
Flag of North Macedonia 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
Avatar of wilcor14

ASKER

What I'm doing is creating a link in the code behind that displays in a label in the HTML code. The code I showed up top should produce the following link:

<a href="#" onclick="opener.location.href='forum/searchpro.aspx?author=admin&top=50';window.close();return false;">Newest 50</a>

But it's creating this link: <a href='#' onclick='opener.location.href='forum/searchpro.aspx?author=admin&top=50';'>Newest 50</a>

I just tried something and it's working. The correct answer is:

<a href=""#"" onclick=""opener.location.href='forum/searchpro.aspx?author=" & sUserID & "&top=50';"">Newest 50</a>