Sunday, March 11, 2012

Error: Control with ID ObjectDataSource1 being registered through RegisterAsyncPostBackCon

So I solved my problem by not using ObjectDataSource Events as Triggers for UpdatePanels. This used to work ATLAS CTP, but now I replaced it with the respective GridView / FormView events and everything is back to working. Anyone know why ObjectDataSource Events can't trigger Update Panels anymore?

I am having this same issue. How would I do the following using the GridView events?

Thanks!

<asp:UpdatePanelID="p1"runat="server">

<ContentTemplate>

<asp:GridViewID="GridView1"runat="server"DataSourceID="photosDS"AutoGenerateEditButton="True"AutoGenerateDeleteButton="False"DataKeyNames="PhotoID"AutoGenerateColumns="False">

<Columns>

<asp:TemplateFieldShowHeader="False">

<ItemTemplate>

<asp:LinkButtonID="lnkBtnDelete"runat="server"CausesValidation="False"CommandName="Delete"

OnClientClick="return confirm ( 'Are you sure you want to permanently delete this image? You will not be able to restore it.' )"Text="Delete"></asp:LinkButton>

</ItemTemplate>

</asp:TemplateField>

<asp:TemplateFieldHeaderText="Include in brochure?">

<ItemTemplate>

<asp:LabelID="LabelInclude"Text='<%#Eval("Include")%>'runat="server"ForeColor="Red"/>

</ItemTemplate>

<EditItemTemplate>

<asp:DropDownListID="IncludeDDL"runat="server"DataSourceID="IncludeDS"DataTextField="Include"DataValueField="Include"SelectedValue='<%# Bind("Include") %>'>

</asp:DropDownList>

</EditItemTemplate>

</asp:TemplateField>

<asp:BoundFieldReadOnly="False"HeaderText="Photo Description"DataField="PhotoDescription"SortExpression="PhotoDescription"/>

<asp:TemplateFieldHeaderText="Photo">

<ItemTemplate>

<asp:HyperLinkID="getPhoto"runat="server"Target="_blank"NavigateUrl='<%# System.Configuration.ConfigurationSettings.AppSettings["ShareLocation"] + Eval("PhotoFileName")%>'ImageUrl='<%# System.Configuration.ConfigurationSettings.AppSettings["VirtualImageDirectory"] + "thumb_" + Eval("PhotoFileName")%>'></asp:HyperLink>

</ItemTemplate>

</asp:TemplateField>

</Columns>

</asp:GridView>

<asp:ButtonID="invisibleButton"runat="Server"ForeColor="white"BackColor="White"BorderColor="White"BorderStyle="None"Width="1px"Height="1px"text="click me"OnClick="invisibleButton_Click"CausesValidation="false"/>

</ContentTemplate>

<Triggers>

<asp:AsyncPostbackTriggerControlID="photosDS"EventName="Updated"/>

<asp:AsyncPostbackTriggerControlID="invisibleButton"EventName="Click"/>

</Triggers>

</asp:UpdatePanel>

No comments:

Post a Comment