when i click a button in asp.net gridview it will execute row command,there i have to write the code to open a specific page... how to do that.
4 Answers
I believe that you're looking for javascript's window.open()
. Here is an example:
// from W3Schools
myWindow=window.open('','','width=200,height=100');
myWindow.document.write("<p>This is 'myWindow'</p>");
myWindow.focus();
If you wish to read more about it, try W3Schools, there is most of information you'll want to know.
Please keep in mind that those additional popup windows drastically decrease user experience, especially on web applications, so you might want to find an alternative, if possible.

- 7,950
- 5
- 40
- 46
instead to use an alert box i recommend to use a popup.
take a look to this link - LIVE EXAMPLE AND REFERENCE TO THIS CODE BELOW
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script>
$(function() {
$( "#dialog" ).dialog({
autoOpen: false,
show: {
effect: "blind",
duration: 1000
},
hide: {
effect: "explode",
duration: 1000
}
});
$( "#opener" ).click(function() {
$( "#dialog" ).dialog( "open" );
});
});
</script>
<div id="dialog" title="Basic dialog">
<iframe src="ShowDetails.aspx"></iframe>
</div>
<button id="opener">Open Dialog</button>

- 4,898
- 15
- 49
- 75
You may programmatically create an iframe and add it to the page. If you position it absolutely it will appear on top of the other content of the page.
HTML:
<a href="javascript:void(0);" id="button">click me</a>
JavaScript:
var button = document.getElementById("button");
button.addEventListener("click", function() {
var frame = document.createElement("IFRAME");
var body = document.querySelector("body");
var width = 300;
var height = 200;
frame.setAttribute("src", "http://www.w3schools.com/tags/tag_iframe.asp");
frame.setAttribute("style", "position: absolute; top: 50%; left: 50%; margin-left: -" + (width/2) + "px; margin-top: -" + (height/2) + "px");
body.appendChild(frame);
});
Here is a jsfiddle showing how this works http://jsfiddle.net/krasimir/LkcLX/1/
P.S. notice that you should set width, height and the url inside the click event handler.

- 13,306
- 3
- 40
- 55
-
what happens is, when i click a button in gridview it will execute row command,there i have to write the code to open a specific page... how to do that. – vinay teja reddy Aug 28 '13 at 09:38
-
Sorry, I don't have experience with ASP. What I gave is pure javascript. I have no idea what you mean by gridview. – Krasimir Aug 28 '13 at 09:44
Got the answer here : How to open a page in a new tab in the rowcommand event of gridview?
String js = "window.open('Signature.aspx', '_blank');";
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Open Signature.aspx", js, true);

- 1
- 1

- 259
- 1
- 4
- 12