Sep 18, 2012, 2:00 PM
[CLOSED] How to add 2 userControl inherited by Ext.Net.Container?
Hi,
I've got written a control inherited from Ext.Net.Container. Now when I add 2 same control with different Ids (contains 1 button with same Id) it's make exception
page code
I've got written a control inherited from Ext.Net.Container. Now when I add 2 same control with different Ids (contains 1 button with same Id) it's make exception
A Control with an ID of "btnSampleButton" has already been initialized. Please ensure that all Controls have a unique id.
Here's example I'm using v1.5 Ext.Netpage code
<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
SampleControl sampleControl1 = new SampleControl();
sampleControl1.ID = "sample1";
SampleControl sampleControl2 = new SampleControl();
sampleControl2.ID = "sample2";
pnlExt.Items.Add(sampleControl1);
pnlExt.Items.Add(sampleControl2);
}
</script>
<!DOCTYPE html>
<html>
<head runat="server">
<title>CardLayout - Ext.NET Examples</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Viewport runat="server">
<Items>
<ext:Panel runat="server" ID="pnlExt"></ext:Panel>
</Items>
</ext:Viewport>
</form>
</body>
</html>
control codeusing Ext.Net;
namespace Sample
{
public class SampleControl : Ext.Net.Container
{
private Ext.Net.Button btnSample;
public SampleControl()
{
btnSample = new Ext.Net.Button{ID="btnSampleButton", Text = "Sample Button " + this.ID};
this.Items.Add(btnSample);
}
}
}
How can I make it work? Please let me know if this is already resolved in Ext.Net 2.0v. I'll reconsider to update newest version if that kind of errors are resolved.
Last edited by Daniil; Sep 21, 2012 at 11:05 AM.
Reason: [CLOSED]