Hi Ranjan,


Try this...


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Display_selected_records._Default" %>





    Untitled Page


   

   

             BackColor="#CCFFCC" Font-Bold="False" ForeColor="Maroon"
            onselectedindexchanged="GridView1_SelectedIndexChanged">
       
   

   

   
   
   

   

            Width="100px">
   
   

   

            Width="100px">
   
   

   

            Width="100px">
   
   

   

            Width="100px">
   
   

   







using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
namespace Display_selected_records
{
    public partial class _Default : System.Web.UI.Page
    {
        string strConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
        string str;
        SqlCommand com;
        SqlDataAdapter sqlda;
        DataSet ds;

        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            lbl_id.Text = GridView1.SelectedRow.Cells[1].Text;
            lbl_name.Text = GridView1.SelectedRow.Cells[2].Text;
            lbl_address.Text = GridView1.SelectedRow.Cells[3].Text;
            lbl_marks.Text = GridView1.SelectedRow.Cells[4].Text;
            lbl_year.Text = GridView1.SelectedRow.Cells[5].Text;
        }

        void bindgrid()
        {
            SqlConnection con = new SqlConnection(strConnString);
            con.Open();
            str = "select * from student";
            com = new SqlCommand(str, con);
            sqlda = new SqlDataAdapter(com);
            ds = new DataSet();
            sqlda.Fill(ds, "student");
            GridView1.DataSource = ds;
            GridView1.DataMember = "student";
            GridView1.DataBind();
            con.Close();
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                bindgrid();
            }
        }
    }
}



Thanks
If this post helps you mark it as answer