Link to home
Start Free TrialLog in
Avatar of Mare22
Mare22

asked on

ASP.NET DataGrid: how to open a new window with binded data

I have a DataGrid.  Here is the server side:

protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                PeopleGrid.DataSource = peopleList;
                //PeopleGrid.Columns[1].Visible = false;
                PeopleGrid.DataBind();
            }
        }

and the client side:

    <asp:DataGrid ID="PeopleGrid" runat="server">
         <Columns>
            <asp:HyperLinkColumn
                 HeaderText="Select a Person"
                 DataNavigateUrlField="Name"
                 DataNavigateUrlFormatString="Details.aspx?id={0}e.Item.Cells[1].Text"
                 DataTextField="Name"
                 Target="_blank"
                 />
         </Columns>

    </asp:DataGrid>

I need to:

(1) make all columns invisible except for the first column that is a list of hyperlinks.
(2) if a hyperlink is clicked, open a new window that contains details on the item clicked.  Below is a page that should be displayed:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Details.aspx.cs" Inherits="PeopleInfo.Details" %>

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

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Label ID="Name" runat="server"></asp:Label>
        <asp:Label ID="Address" runat="server"></asp:Label>
        <asp:Label ID="Email" runat="server"></asp:Label>
    </div>
    </form>
</body>
</html>

Thank you.
ASKER CERTIFIED SOLUTION
Avatar of Easwaran Paramasivam
Easwaran Paramasivam
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial