Here a sample to reproduce the behaviour: it's a webform with some VB code-behind, you shoud create a new AJAX-enabled application and past the following code.
(DEFAULT.ASPX)
[HTML]
<%@ Page Language="VB" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:sqldatasource id="SqlDataSource1" runat="server"
connectionstring="Server=s-netbe1;UID=netbe;PWD=netbe;Database=versione2-tmp;"
selectcommand="SELECT * FROM wtesti"
></asp:sqldatasource>
<div>
-<%=DateTime.Now%>-
<asp:updatepanel id="upddgd" runat="server">
<contenttemplate>
<asp:label id="labprova" runat="server"></asp:label>
<asp:datagrid id="dgdprova" runat=server datasourceid="sqldatasource1" autogeneratecolumns="false">
</asp:datagrid>
</contenttemplate>
</asp:updatepanel>
</div>
</form>
</body>
</html>
[/HTML]
(DEFAULT.ASPX.VB)
Expand|Select|Wrap|Line Numbers
- Partial Class _Default
- Inherits System.Web.UI.Page
- Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
- Dim dat As New BoundColumn
- dat.DataField = "titolo1"
- dgdprova.Columns.Add(dat)
- Dim ajx As New ButtonColumn
- ajx.CommandName = "ajax"
- ajx.Text = "Ajax"
- dgdprova.Columns.Add(ajx)
- Dim pst As New ButtonColumn
- pst.CommandName = "post"
- pst.Text = "Postback"
- dgdprova.Columns.Add(pst)
- Me.dgdprova.DataBind()
- End Sub
- Protected Sub dgdprova_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgdprova.ItemCommand
- Me.labprova.Text = "PB " + Now.ToLongTimeString
- End Sub
- Protected Sub dgdprova_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgdprova.ItemDataBound
- Select Case e.Item.ItemType
- Case ListItemType.AlternatingItem, ListItemType.Item
- Dim cella As New TableCell
- cella = e.Item.Cells(2)
- Dim tr As New PostBackTrigger
- tr.ControlID = cella.Controls(0).ClientID
- Me.upddgd.Triggers.Add(tr)
- End Select
- End Sub
- End Class
A control with ID 'dgdprova_ctl02_ctl01' could not be found for the trigger in UpdatePanel 'upddgd'.
[InvalidOperationException: A control with ID 'dgdprova_ctl02_ctl01' could not be found for the trigger in UpdatePanel 'upddgd'.]
System.Web.UI.UpdatePanelControlTrigger.FindTarget Control(Boolean searchNamingContainers) +315
System.Web.UI.PostBackTrigger.Initialize() +12
System.Web.UI.UpdatePanelTriggerCollection.Initial ize() +65
System.Web.UI.UpdatePanel.Initialize() +37
System.Web.UI.UpdatePanel.OnLoad(EventArgs e) +51
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436
Any help would be appreciated!