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].Vi sible = false;
PeopleGrid.DataBind();
}
}
and the client side:
<asp:DataGrid ID="PeopleGrid" runat="server">
<Columns>
<asp:HyperLinkColumn
HeaderText="Select a Person"
DataNavigateUrlField="Name "
DataNavigateUrlFormatStrin g="Details .aspx?id={ 0}e.Item.C ells[1].Te xt"
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.c s" Inherits="PeopleInfo.Detai ls" %>
<!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.
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
PeopleGrid.DataSource = peopleList;
//PeopleGrid.Columns[1].Vi
PeopleGrid.DataBind();
}
}
and the client side:
<asp:DataGrid ID="PeopleGrid" runat="server">
<Columns>
<asp:HyperLinkColumn
HeaderText="Select a Person"
DataNavigateUrlField="Name
DataNavigateUrlFormatStrin
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.c
<!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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.