Tags: ajax, aspnet, cant, control, error, extender, extends, lamest, net, record, updatepanel

"An extender cant be in a different UpdatePanel than the control it extends." error really

On .Net » ASP.NET AJAX

15,194 words with 10 Comments; publish: Sat, 05 Jan 2008 23:32:00 GMT; (100218.75, « »)

I'd just like to go on record that "An extender can't be in a different UpdatePanel than the control it extends. " is the lamest error ever. With zero indication of which of the 30-40 different extenders that are on a page, it makes it IMPOSSIBLE to debug what's wrong with migrating to the new version. After about 40 minutes of double-tripple-quadruple-etc checking this page, I'm down to the whole "delete everything, start over" to try and diagnose this craptacular error. Then, I'll probably get to do the same thing to the other 67 pages in this project. Lordy.

All Comments

Leave a comment...

  • 10 Comments
    • That is a difference of the new release over previous... The error however is explicit - any controls that have target properties to point to something that the Update Panel triggers on can only be placed within the update panel... HOWEVER... there is an override by programtically overriding it using the "ChldrenAsTriggers" property...http://ajax.asp.net/docs/mref/0b850465-67ca-2600-9fdc-2c16d689ab89.aspx

      May help depending on how you are going about the coding process... but the ChildrenAsTriggers property as far as I understand allow for using external controls as triggers...

      #1; Sat, 05 Jan 2008 23:34:00 GMT
    • Explicit?? It tells you what the error is but doesn't give any context. It's marginally better than saying "there is an error on the page...go fix it" ;-)

      This error needs to provide information about the extender that is causing the problem. It is very difficult trying to track down the culprit and the inclusion of the offending control would make it obvious.

      #2; Sat, 05 Jan 2008 23:35:00 GMT
    • It’s actually a simple fix. I had this problem too. Before, the extender controls were grouped together by type. You could place them almost anywhere on the page. I placed all of mine at the bottom of the page.

      Now that all the extenders are separate, the markup for some reason needs to be placed in the same update panel as the target control. I did that and it works fine for me, all except for one thing.

      I am using control extenders in an EditItemTemplate of a GridView. This worked before, but now those control extenders have no affect on the target control.

      Is anybody else having this problem?

      #3; Sat, 05 Jan 2008 23:36:00 GMT
    • yes i have the exact same problem... only diff... mine is datalist and yours is gridview...

      can anyone help me with that?

      Thanks...

      #4; Sat, 05 Jan 2008 23:37:00 GMT
    • My code throws this error too.

      <asp:DropDownList ID="ddlItem1" runat="server" DataSourceID="dosComponents" DataTextField="name" DataValueField="id">

      </asp:DropDownList>

      <br /><br />

      <asp:DropDownList ID="ddlItem2" AutoPostBack="true" OnSelectedIndexChanged="ddlItem2_SelectedIndexChanged" runat="server" DataTextField="name" DataValueField="id">

      </asp:DropDownList>

      <br /><br />

      <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" RenderMode="inline">

      <ContentTemplate>

      <asp:DropDownList ID="ddlItem3" runat="server" DataTextField="name" DataValueField="id">

      </asp:DropDownList>

      <br /><br />

      <asp:Label ID="Label1" runat="server" Text="[No response provided yet]" />

      </ContentTemplate>

      <Triggers>

      <asp:AsyncPostBackTrigger ControlID="ddlItem2" EventName="SelectedIndexChanged" />

      </Triggers>

      </asp:UpdatePanel>

      What I want to do is set the visibility of ddlItem3 DropDownList to false if there are no items populated based on the selection from ddlItem2 using AJAX so there are no page post backs. But the Update control won't allow me to put the ddlItem3 inside the UpdatePanel. It throws this error. Help or alternative workaround suggestions appreciated.

      #5; Sat, 05 Jan 2008 23:38:00 GMT
    • By the way, I haven't gotten a reply from my last 4 or so posts. I guess this community is tired of the same old questions. Well I'd appreciate a reply to this post if anyone has the knowledge and 1-2 minutes of their time.
      #6; Sat, 05 Jan 2008 23:39:00 GMT
    • I just tried this and it seemed to work(I put this in a content tag, my masterpage has the scriptmanager), but I don't know if there was something else on the page causing it not to work for you.

      <scriptlanguage="C#"runat="server">protectedvoid ddlItem2_SelectedIndexChanged(object sender,EventArgs e)

      {

      if (ddlItem2.SelectedItem.Text =="1")

      ddlItem3.Visible =

      true;else

      ddlItem3.Visible =

      false;

      }

      </script><asp:DropDownListID="ddlItem2"AutoPostBack="true"runat="server"OnSelectedIndexChanged="ddlItem2_SelectedIndexChanged"><asp:ListItemText="1"/><asp:ListItemText="2"/></asp:DropDownList><asp:UpdatePanelID="up_ddlItem3"runat="server"UpdateMode="Conditional"><ContentTemplate><asp:DropDownListID="ddlItem3"runat="server"><asp:ListItemText="Got"Selected="true"/></asp:DropDownList></ContentTemplate><Triggers><asp:AsyncPostBackTriggerControlID="ddlItem2"EventName="SelectedIndexChanged"/></Triggers></asp:UpdatePanel>
      #7; Sat, 05 Jan 2008 23:40:00 GMT
    • Thanks. I left out that my dropdownlists are CascadingDropDown controls. I moved my CascadingDropDown AJAX control definitions into the UpdatePanel with my DropDownLists and the page loads fine. But it doesn't solve my problem of setting visibility to false.

      I tried to check if the 3rd DropDown is enabled or checking the item count but these properties don't seem to correspond with what I'm seeing on my screen. Probably because they are set by JavaScript.

      protected void ddlItem2_SelectedIndexChanged(object sender, EventArgs e)

      {

      if (ddlItem3.Enabled)// (ddlItem3.Items.Count > 0)

      ddlItem3.Visible = true;

      else

      ddlItem3.Visible = false;

      Label1.Text = ddlItem2.SelectedItem.Text;

      }

      By the way, thank you for the reply

      #8; Sat, 05 Jan 2008 23:41:00 GMT
    • Sorry I guess I am have problems communicating my problem properly today. I can set the visibility to false but I cannot check to see if my 3rd CascadingDropDown is populated by the selections of the second list.

      #9; Sat, 05 Jan 2008 23:42:00 GMT
    • I spent a couple of hours on this before discovering that theAjax Extender I am using has to be in the same UpdatePanel as the control it points to with its TargetControlID.

      <asp:UpdatePanel>

      -- more HTML --

      <asp:ButtonID="btnAddContestant"runat="server"BackColor="LightGreen"Font-Names="Arial"

      ForeColor="Black"Text="Add Contestant"/><br/>

      <%-- Ajax Extender has to be in the same UpdatePanel as its TargetControlID --%>

      <ajaxToolkit:ModalPopupExtenderID="ModalPopupExtender1"runat="server"TargetControlID="btnAddContestant"PopupControlID="pnlAddContestant"BackgroundCssClass="modalBackground"DropShadow="true"OkControlID="btnOK"CancelControlID="btnCancel">

      </ajaxToolkit:ModalPopupExtender>

      </contenttemplate>

      </asp:UpdatePanel>

      #10; Sat, 05 Jan 2008 23:43:00 GMT