I was getting this error when pressing the asp:Button that was inside the asp:UpdatePanel. The code was in a Web User Control
<asp:TemplateField HeaderText="Fecha Expiración" SortExpression="FechaExp" ItemStyle-HorizontalAlign="Center" >
<ItemTemplate>
<asp:Button ID="btnExpComFecha" runat="server" Text="[+]" style="background-color: Transparent"
BorderStyle="None" ToolTip="Mostrar u ocultar la fecha de expiración del documento"
CommandName="ExpComFecha" CommandArgument="<%# CType(Container,GridViewRow).RowIndex %>" />
<asp:UpdatePanel ID="panFecha" runat="server" Visible="False">
<ContentTemplate>
<asp:Calendar ID="calFechaExp" runat="server" FirstDayOfWeek="Monday" CellPadding="1"
SelectedDate='<%# IIf(IsDBNull(Eval("FechaExp")), DateTime.MinValue, Eval("FechaExp")) %>'
VisibleDate='<%# IIf(IsDBNull(Eval("FechaExp")), DateTime.Now, Eval("FechaExp")) %>' >
</asp:Calendar>
<asp:Button ID="btnUpdFecha" runat="server" Text="Actualizar" CommandName="ActualizarFecha"
CommandArgument="<%# CType(Container,GridViewRow).RowIndex %>" />
</ContentTemplate>
</asp:UpdatePanel>
</ItemTemplate>
</asp:TemplateField>
I fixed it with this code, that I based on this http://www.dotnetspider.com/resources/29004-A-control-with-ID-button-could-not-be-found.aspx
Private Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
Dim oScriptManager As ScriptManager = ScriptManager.GetCurrent(Me.Page)
For Each oRow As GridViewRow In Me.grdDocumentosSuplidor.Rows
Dim oButton As Button = DirectCast(oRow.FindControl("btnUpdFecha"), Button)
oScriptManager.RegisterPostBackControl(oButton)
Next
End Sub
Another option was to use an asp:LinkButton, that doesn’t have that problem…