Click here to Skip to main content
13,044,927 members (44,378 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I have two pages. Grid view page and profile page.

In the first page, there is one databound field(id), and the hyperlink(profile).

If i click the hyperlink i can view the full staff details in separate web page(using "id" as a session)

Plz help me...

Thank you in advance
Posted 11-Feb-13 17:52pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I am assuming you need an example of Grid View and Details View. Please have a look at following link:
GridView and Details View[^][^]
GridView-DetailsView (Master/Detail) Control[^]
Rate this: bad
Please Sign up or sign in to vote.

Solution 2


<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
            <asp:BoundField DataField="id" HeaderText="id" />
            <asp:BoundField DataField="name" HeaderText="name" />
            <asp:BoundField DataField="address" HeaderText="address" />
            <asp:LinkButton ID="XXXXX" runat="server" Text="NEW PAGE" CommandName="AA" CommandArgument='<%#Eval("id") %>' />



using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)
        if (!IsPostBack)
    protected void BindGridview()
        using (SqlConnection con = new SqlConnection("--------"))
            SqlCommand cmd = new SqlCommand("Select * FROM TEST", con);
            SqlDataReader dr = cmd.ExecuteReader();
            GridView1.DataSource = dr;
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        if (e.CommandName == "AA")
            string id = e.CommandArgument.ToString();
            //if u want to use querystring//
            Server.Transfer("Default2.aspx?id=" + id);
            // if u want to use session//
            // Session["id"] = id.ToString();
            // Server.Transfer("Default2.aspx");

protected void Page_Load(object sender, EventArgs e)
        string id=Request.QueryString["id"];//for query string
        //string id1 = Session["id"].ToString();//for session

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170713.1 | Last Updated 12 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100