New window + server side method

  • Thread starter Thread starter Loui Mercieca
  • Start date Start date
L

Loui Mercieca

I need the functionality of the _blank of the hyperlink but need the onclick
functionality of the LinkButton. Did anyone have this problem?

Basically what i need is that once the user clicks on a control ( either
hyperlink, linkbutton or whatever ) a method will be executed on the server
and then a new window will be opened with a specific url.

Thanks,
 
Maybe what might work for you is something along the lines of:

<script type="text/javascript">
function MyFunction(target) {
window.open(target);
}
</script>
<asp:HyperLink runat="server"
NavigateUrl="JavaScript:MyFunction("+MyVariable+")" />

Which boils down to sort of mixing server side and client side code (as
server side code cannot open a new window for instance) where you
server side create a client side function call.

HTH,
Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top