Opener


N

netnatter

My grid view has a select button. When clicked I want to open a details page
in a new browser window.

I know how to open a new browser window but am mystified as to how to link
it to the gridview button

My test code is below and I would prefer replies to ammend to this as I have
Googled for help already and am still mystified.

Thanks

-----------
<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs)

End Sub

Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs)
Dim name As String
name = Trim(GridView1.SelectedRow.Cells(0).Text)
Response.Redirect("http://www.mywebsite.co.uk/details.aspx?name=" &
name)

End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<script type="text/javascript">
function load() {
var load = window.open('http://www.mywebsite.co.uk/details.aspx', '',
'scrollbars=no,menubar=no,height=600,width=800,resizable=yes,toolbar=yes,location=no,status=no');
}
// -->
</script>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<i><a href="javascript:load()">Open FAQ Window</a></i>
</div>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:myhostConnectionString %>"
SelectCommand="SELECT [name], [gender], [height] FROM [aboutus]">
</asp:SqlDataSource>
<br />
<br />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1"
onselectedindexchanged="GridView1_SelectedIndexChanged"
Width="350px">
<Columns>
<asp:BoundField DataField="name" HeaderText="name"
SortExpression="name" />
<asp:BoundField DataField="gender" HeaderText="gender"
SortExpression="gender" />
<asp:BoundField DataField="height" HeaderText="height"
SortExpression="height" />
<asp:CommandField ButtonType="Button" ShowSelectButton="True" />
</Columns>
</asp:GridView>
</form>
</body>
</html>
--------------------
 
Ad

Advertisements


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

Top