passing gridview particular row datas to another page in asp.net?
<p>i want to set session in login page and want to pass one page girdview data to another page.</p>

<pre><code>slno  title     author    publication    takenby
  1    book1    author1   pub1           sendrequest (button)
</code></pre>

<p>Above image showing gridview. when i click the Request Book button(1st one). it will redirect to sendrequest.aspx page. and have to bring that row data (i.e) </p>

<pre><code>slno=1
title=book1
Author=author1
publication=publ
</code></pre>

<p>i tried below code
user.aspx.cs</p>

<pre><code> protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
            {
                string user = (string)(Session["User"]);
                if (e.CommandName.Equals("SendRequestCmd"))
                {
                    if (user == null)
                    {
                        Session["slno"] = null;
                        Session["bookname"] = null;
                        var clickedRow = ((Button)e.CommandSource).NamingContainer as GridViewRow;
                        // now access the cells like this
                        SlNo = clickedRow.Cells[0].Text;
                        Session["slno"] = SlNo.ToString();
                        BookName = clickedRow.Cells[1].Text;
                        Session["bookname"] = BookName.ToString();
                    }
                }
            }
</code></pre>

<p>sendquest.aspx.cs</p>

<pre><code>protected void Page_Load(object sender, EventArgs e)
        {
            string slno = "", bookname = "";
            slno = (string)(Session["slno"]);
            bookname = (string)(Session["bookname"]);
            if (slno == null || bookname == null)
            {
                Response.Write("serial no: " + slno + "\nbookname: " + bookname);
            }
        }
        protected void Logout()
        {
            Session.Clear();
        }
</code></pre>

<p>but i got error in </p>

<pre><code>slno=(string)(Session["slno"]);
bookname=(string)(Session["bookname"]);
</code></pre>

<p>why? anybody correct it?
else say better way?</p>
