How to avoid not to create another new window in Gridview?
Dear Buddies ,
I had a situation in the Gridview..that contain the Link Button. when i click the link button it will fetch the data corresponding to the querystring variable.Those Information to be display in a new window..
In this if i click the same querystring variable , again it showed the data in another new window..i want it to be as, if it is loaded already that should not open new window...
If it is not loaded already , it should load on that page ..
This is My requirements ....
Thanks in advance
-karthik

Abhishek JainPosted Aug 13, 2013, 9:50 AM
Actually while opening a new window you have to provide the window name, so if you will keep the same window name for a single row, then automatically already open window will be refreshed.
Suppose you are having three rows in Gridview each having a Linkbutton. On click of Linkbutton you want to open a new window, so for doing that you must be handling on client click event and from the script you must be doing window.open
window.open syntax:
window.open(URL,name,specs,replace)
You if you will see there is a parameter name i.e. window name, so if you will keep it as same the same window which was open earlier will automatically be refreshed. so for each row in the Gridview keep the Window name different, so that for each row a new window gets opened and if the same row Linkbutton is clicked again the same window which was opened earlier will get refreshed.
e.g. For the first row you can keep "Window1" as window name, for second row "Window2" as window name.
Sample Code:
function OpenWindow(Id)
{
var windowName = 'WindowName' + id;
window.open(
return false;
}