show data in outside textbox from selected row in gridview
<p>I am having a grid view created by using template fields.  I inserted a link button using template fields in the grid view.
There are 4 textboxes outside the GridView.. i want to select the row on link button's click and  put the selected row's data in text boxes.  I am using a row command even for this but its not working ... the syntax i am using is .: </p>

<pre><code>&lt;asp:GridView ID="gview" AutoGenerateColumns="False" runat="server" CellPadding="4" 
        ForeColor="#333333" GridLines="None" onrowcommand="gview_RowCommand"&gt;
    &lt;AlternatingRowStyle BackColor="White" ForeColor="#284775" /&gt;
&lt;Columns&gt;
&lt;asp:TemplateField HeaderText="Book Name"&gt;
&lt;ItemTemplate&gt;
&lt;%#Eval("book_name") %&gt;
&lt;/ItemTemplate&gt;
&lt;/asp:TemplateField&gt;
&lt;asp:TemplateField HeaderText="Book Author"&gt;
&lt;ItemTemplate&gt;
&lt;%#Eval("book_author") %&gt;
&lt;/ItemTemplate&gt;
&lt;/asp:TemplateField&gt;
&lt;asp:TemplateField HeaderText="Book Publisher"&gt;
&lt;ItemTemplate&gt;
&lt;%#Eval("book_Publisher") %&gt;
&lt;/ItemTemplate&gt;
&lt;/asp:TemplateField&gt;
&lt;asp:TemplateField HeaderText="Book Price"&gt;
&lt;ItemTemplate&gt;
&lt;%#Eval("book_Price") %&gt;
&lt;/ItemTemplate&gt;
&lt;/asp:TemplateField&gt;
&lt;asp:TemplateField HeaderText="Update"&gt;
&lt;ItemTemplate&gt;


&lt;asp:LinkButton ID="lnkDet" CommandName="cmdBind" CommandArgument="&lt;%# ((GridViewRow) Container).RowIndex %&gt;"  runat="server" CausesValidation="false"&gt;View Details&lt;/asp:LinkButton&gt;
&lt;/ItemTemplate&gt;
&lt;/asp:TemplateField&gt;   

&lt;/Columns&gt;
</code></pre>

<p>and Code behind file : </p>

<pre><code>protected void gview_RowCommand(object sender, GridViewCommandEventArgs e)
{
    if (e.CommandName == "cmdBind")
    {
        LinkButton lb = (LinkButton)e.CommandSource;
        int index = Convert.ToInt32(lb.CommandArgument);


        //Bind values in the text box of the pop up control
        txt_name.Text = gview.Rows[index].Cells[0].Text;
        txt_author.Text = gview.Rows[index].Cells[1].Text;
        txt_price.Text = gview.Rows[index].Cells[2].Text;
    }
}
</code></pre>

<p>Can anyone tell me how to do this.</p>
