asp.net, javascript getElementById to linkbutton
<p>im using asp.net with c#.</p>

<p>I have a gridview and there is a TemplateField column. Inside the TemplateField column there is a EditItemTemplate, and inside EditItemTemplate the is a linkbutton(LinkButton1).</p>

<p>Im trying to do a getelementbyid on the linkbutton from a javascript function:</p>

<pre><code>document.getElementById("&lt;%= LinkButton1.ClientID %&gt;").disabled = true;
</code></pre>

<p>But when compiling, I get the error: "The LinkButton1" does not exist on the current context.</p>

<p>The aspx gridview code:</p>

<pre><code>&lt;asp:GridView ID="GridView1" runat="server" Height="157px" Width="814px" 
             CellPadding="4" ForeColor="#333333" GridLines="None"
             OnRowEditing="GridView1_RowEditing"
             OnRowCancelingEdit="GridView1_RowCancelingEdit" 
             OnRowUpdating="GridView1_RowUpdating" AutoGenerateColumns="False" 
             OnRowDataBound="GridView1_RowDataBound"
              onrowdeleting="GridView1_RowDeleting" Font-Size="Medium" 
            AllowPaging="True" onpageindexchanged="GridView1_PageIndexChanged" onpageindexchanging="GridView1_PageIndexChanging"     &gt;
            &lt;RowStyle BackColor="#F7F6F3" ForeColor="#333333" /&gt;
&lt;Columns&gt;
&lt;asp:TemplateField ShowHeader="False"&gt;
&lt;EditItemTemplate&gt;
        &lt;asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update"
            Text="Actualizar" ValidationGroup="upd_validation"&gt;&lt;/asp:LinkButton&gt;
        &lt;asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel"
            Text="Cancelar"&gt;&lt;/asp:LinkButton&gt;
&lt;/EditItemTemplate&gt;      
&lt;ItemTemplate&gt;
        &lt;asp:LinkButton ID="LinkButton3" runat="server" CausesValidation="False" CommandName="Edit"
            Text="Editar"&gt;&lt;/asp:LinkButton&gt;
        &lt;asp:LinkButton ID="LinkButton4" runat="server" CausesValidation="False" CommandName="Delete"
            Text="Eliminar" CommandArgument='&lt;%# Container.DataItemIndex %&gt;' onclientClick="return ConfirmDelete()"&gt;&lt;/asp:LinkButton&gt;                         
&lt;/ItemTemplate&gt;                
&lt;/asp:TemplateField&gt;
</code></pre>

<p>How can I solve this?</p>

<p>Thanks.</p>
