UpdatePanel in FormView name conflict compilation error

Last post 02-12-2008 11:01 AM by Erasmus. 15 replies.

Sort Posts:

  • UpdatePanel in FormView name conflict compilation error

    01-01-2007, 6:27 AM
    • Loading...
    • alonc
    • Joined on 01-01-2007, 11:12 AM
    • Posts 3

    I have a FormView with an InsertItemTemplate and EditItemTemplate templates.

    Each template contains controls with the same ID.

    Its work’s fine since the controls with the same ID are in different templates.

    I added UpdatePanel to one of the templates to wrap some of the controls and it works exactly as expected.

    When I'm adding UpdatePanel to the second template I got a name conflict compilation error.

    The name conflicts is for the controls inside the UpdatePanel

    I am using AJAX 1.0 RC

     

    Any help would be great.

     

    This are the errors that I got from my sample code

     

    • The type 'Default' already contains a definition for 'Label1'
    • The type ‘Default’  already contains a definition for 'Button2'
    • Type 'ASP.default_aspx' already defines a member called '__BuildControlLabel1' with the same parameter types
    • Type 'ASP.default_aspx' already defines a member called '__BuildControlButton2' with the same parameter types

     

    This is the sample code:

      

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" EnableEventValidation="false" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <script runat="server">
    protected void Button2_Click(object sender, EventArgs e)
    {
    Label lbl = FormView1.FindControl("Label1") as Label;
    lbl.Text = DateTime.Now.ToString();
    }

    </script>

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>Untitled Page</title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:FormView ID="FormView1" runat="server" OnPreRender="FormView1_PreRender" DefaultMode="Insert">
    <EditItemTemplate><asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
    <asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Button" />
    </ContentTemplate>
    </asp:UpdatePanel>
    </EditItemTemplate>
    <InsertItemTemplate>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
    <asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Button" />
    </ContentTemplate>
    </asp:UpdatePanel>
    </InsertItemTemplate>
    </asp:FormView>
    </div>
    </form>
    </body>
    </html>
     

  • Re: UpdatePanel in FormView name conflict compilation error

    01-09-2007, 4:49 AM
    Answer
    This is known issue for custom controls (currently VS2005 IDE doesn’t fully support AJAX yet, Orcas will fully support it).
    http://bugcheck/bugs/DevDivBugs/36009.asp
    DevDiv Bugs 36009 - About VS2005 warning "Another object on this page already uses ID xxx"




    Sincerely,
    JiCheng Wang
    Microsoft Online Community Support

    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: UpdatePanel in FormView name conflict compilation error

    01-10-2007, 5:25 AM
    • Loading...
    • alonc
    • Joined on 01-01-2007, 11:12 AM
    • Posts 3

    Thank you for the replay.

    The link in your post ( http://bugcheck/bugs/DevDivBugs/36009.asp ) do not open any bug description…

    Do you know any workaround this problem?

    Thanks

    Alon

  • Re: UpdatePanel in FormView name conflict compilation error

    01-10-2007, 8:01 PM
    http://bugcheck/bugs/DevDivBugs/36009.asp can only be accessed from Microsoft intranet,not internet. This is a known issue for custom controls and may be fixed in ASP.NET AJAX RTM.
    Sincerely,
    JiCheng Wang
    Microsoft Online Community Support

    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: UpdatePanel in FormView name conflict compilation error

    01-10-2007, 10:16 PM
    Answer
    I'd like to give you two suggestions for you.They should work fine.
    1.Try to change your codes as the following - Place a asp:Formview in a asp:UpdatePanel and specify post back through the triggers
     of the asp:UpdatePanel

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <asp:FormView ID="FormView1" runat="server" OnPreRender="FormView1_PreRender" DefaultMode="Insert">
    <EditItemTemplate>
    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
    <asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Button" />
    </EditItemTemplate>
    <InsertItemTemplate>
    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
    <asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Button" />
    </InsertItemTemplate>
    </asp:FormView>
    </ContentTemplate>
    <Triggers>
    <asp:PostBackTrigger ControlID="FormView1" />
    </Triggers>
    </asp:UpdatePanel>
    2.Try to change your codes as the following - Change the asp:Label ID and asp:Button ID in the InsertItemTemplate of the asp:FormView
    <asp:FormView ID="FormView1" runat="server" OnPreRender="FormView1_PreRender" DefaultMode="Insert">
    <EditItemTemplate>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
    <asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Button" />
    </ContentTemplate>
    </asp:UpdatePanel>
    </EditItemTemplate>
    <InsertItemTemplate>
    <asp:UpdatePanel ID="UpdatePanel3" runat="server">
    <ContentTemplate>
    <asp:Label ID="Label10" runat="server" Text="Label"></asp:Label>
    <asp:Button ID="Button20" runat="server" OnClick="Button2_Click" Text="Button" />

    </ContentTemplate>
    </asp:UpdatePanel>
    </InsertItemTemplate>
    </asp:FormView>

    Wish the above can help you.
    Sincerely,
    JiCheng Wang
    Microsoft Online Community Support

    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: UpdatePanel in FormView name conflict compilation error

    01-14-2007, 6:45 AM
    • Loading...
    • alonc
    • Joined on 01-01-2007, 11:12 AM
    • Posts 3

    Thank you for you help

    Alon 

  • Re: UpdatePanel in FormView name conflict compilation error

    01-29-2007, 3:27 PM
    • Loading...
    • Gazelem67
    • Joined on 11-18-2005, 10:29 PM
    • Marietta, GA
    • Posts 6

    Ji Cheng Wang - MSFT:
    http://bugcheck/bugs/DevDivBugs/36009.asp can only be accessed from Microsoft intranet,not internet. This is a known issue for custom controls and may be fixed ASP.NET AJAX RTM.

    And has this been fixed?  Because I'm still getting the error. 

  • Re: UpdatePanel in FormView name conflict compilation error

    02-08-2007, 11:39 AM
    • Loading...
    • MetalJon
    • Joined on 01-11-2007, 6:24 PM
    • California
    • Posts 11
    Gazelem67:

    Ji Cheng Wang - MSFT:
    http://bugcheck/bugs/DevDivBugs/36009.asp can only be accessed from Microsoft intranet,not internet. This is a known issue for custom controls and may be fixed ASP.NET AJAX RTM.

    And has this been fixed?  Because I'm still getting the error. 

    Ditto. I'm using RTM and currently encountering this error. It's a major drag at this stage, too; I'm already past my deadline.

  • Re: UpdatePanel in FormView name conflict compilation error

    02-11-2007, 4:20 AM
    Hello All,
        What I provided about ASP.NET AJAX bugs fixed in AJAX RTM version here may be not exactly correct because I don't do ASP.NET AJAX forums support from January 2007.Please pay attention to ASP.NET AJAX updates through http://Ajax.asp.net website. Thanks for your attention to ASP.NET AJAX progress.
    Sincerely,
    JiCheng Wang
    Microsoft Online Community Support

    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: UpdatePanel in FormView name conflict compilation error

    02-12-2008, 11:00 AM
    • Loading...
    • Erasmus
    • Joined on 10-18-2006, 2:44 PM
    • Posts 20

    An improvement on option 1 detailed by Ji is to use the <asp:AsyncPostBackTrigger specifying EventName="Load".

     

    This

    causes
  • Re: UpdatePanel in FormView name conflict compilation error

    02-12-2008, 11:00 AM
    • Loading...
    • Erasmus
    • Joined on 10-18-2006, 2:44 PM
    • Posts 20

    An improvement on option 1 detailed by Ji is to use the <asp:AsyncPostBackTrigger specifying EventName="Load".

    This causes an

  • Re: UpdatePanel in FormView name conflict compilation error

    02-12-2008, 11:00 AM
    • Loading...
    • Erasmus
    • Joined on 10-18-2006, 2:44 PM
    • Posts 20

    An improvement on option 1 detailed by Ji is to use the <asp:AsyncPostBackTrigger specifying EventName="Load".

    This causes an asynchronous

  • Re: UpdatePanel in FormView name conflict compilation error

    02-12-2008, 11:00 AM
    • Loading...
    • Erasmus
    • Joined on 10-18-2006, 2:44 PM
    • Posts 20

    An improvement on option 1 detailed by Ji is to use the <asp:AsyncPostBackTrigger specifying EventName="Load".

    This causes an asynchronous

    page
  • Re: UpdatePanel in FormView name conflict compilation error

    02-12-2008, 11:00 AM
    • Loading...
    • Erasmus
    • Joined on 10-18-2006, 2:44 PM
    • Posts 20

    An improvement on option 1 detailed by Ji is to use the <asp:AsyncPostBackTrigger specifying EventName="Load".

    This causes an asynchronous

    page refresh rather than a
  • Re: UpdatePanel in FormView name conflict compilation error

    02-12-2008, 11:00 AM
    • Loading...
    • Erasmus
    • Joined on 10-18-2006, 2:44 PM
    • Posts 20

    An improvement on option 1 detailed by Ji is to use the <asp:AsyncPostBackTrigger specifying EventName="Load".

    This causes an asynchronous

    page refresh rather than a standard
Page 1 of 2 (16 items) 1 2 Next >