Accessing TextArea Inside GridView with JQuery BlockUI
<p>This is driving me nuts! </p>

<p>I am trying to access a TextArea inside the GridView control. The TextArea is popped up when a button on a gridview is clicked. For some reason the textarea.value always contains "    ". </p>

<pre><code>&lt;asp:GridView ID="gvCategories" runat="server" AutoGenerateColumns="false" 
            onrowcommand="gvCategories_RowCommand"&gt;

    &lt;Columns&gt;
    &lt;asp:TemplateField&gt;
    &lt;ItemTemplate&gt;
        &lt;input type="button" value="add comment" onclick="showCommentBox()" /&gt;
    &lt;/ItemTemplate&gt;
    &lt;/asp:TemplateField&gt;

     &lt;asp:TemplateField&gt;
    &lt;ItemTemplate&gt;
       &lt;div id="commentBox" style="display:none"&gt;

     &lt;input type="button" value="move comment input box" onclick="moveComment()" /&gt; 


    &lt;textarea id="txtComment" rows="10" cols="30"&gt;
    &lt;/textarea&gt;

    &lt;/div&gt;   
    &lt;/ItemTemplate&gt;
    &lt;/asp:TemplateField&gt;

    &lt;/Columns&gt;

    &lt;/asp:GridView&gt;




function moveComment() {

        alert(document.getElementById("txtComment").value);  

    }
</code></pre>

<p>I have added this code on the server side but the TextBox always returns " " </p>

<pre><code>  protected void gvCategories_RowCommand(object sender, GridViewCommandEventArgs e)
        {

            var row = (GridViewRow) (e.CommandSource as LinkButton).NamingContainer;
            var description = (row.FindControl("txtDescription") as TextBox).Text;
            lblComment.Text = description; 
        }
</code></pre>
