link button and _blank window

D

Douglas Gierow

a long time ago, someone asked the question:

"I'm using a link button for a Select Button Column in a datagrid.
Based on information within the grid I'm doing a response.redirect to
a different page. However, I'd like to open a new window. How is
this done?"

i had the same problem so here's my fix:

add a hidden input variable to the html form. set value="0" and
runat="server". then in the SelectedIndexChanged event of the
datagrid, set the value="1". add a javascript function to the page
that looks like this:

function openNewWindow() {
if (document.all.openNewWindowFlag.value == 1) {
window.open('mypage.aspx','_blank',width=980,height=650');
}
}

call this function from the onload event on the body tag:

<body onload="javascript: openNewWindow();">

and that's it. there is probably a better way to do this, so if
anyone has another solution, post it.
 

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

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top