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>