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

Posted on 2011-10-07
Last Modified: 2012-05-12
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;

and the client side:

    <asp:DataGrid ID="PeopleGrid" runat="server">
                 HeaderText="Select a Person"


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" "">

<html xmlns="">
<head runat="server">
    <form id="form1" runat="server">
        <asp:Label ID="Name" runat="server"></asp:Label>
        <asp:Label ID="Address" runat="server"></asp:Label>
        <asp:Label ID="Email" runat="server"></asp:Label>

Thank you.
Question by:Mare22
    1 Comment
    LVL 16

    Accepted Solution

    You can hide the columns of Grids by setting hiddenfiled as itemtemplate or programatically set column.visible = false. Set the column who has data to be passed as querystring as DataKeynames. Then the ID will be taken even it is hidden.

    Please refer below links:


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
    In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now