I Need Your Help To Solve The Following Problem.Thanks.
I want to use WebPartZone control (NOT ATLAS) like this:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False">
<Columns>
<asp:TemplateField HeaderText="templatecol">
<ItemTemplate>
<asp:WebPartZone ID="WebPartZone1" runat="server">
<ZoneTemplate>
<asp:Button ID="Button1" runat="server" Text="Button" />
</ZoneTemplate>
</asp:WebPartZone>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
In my project, I bind data for the gridview in Page_Init(), the error is:
Server Error in '/' Application.
A Web Part or Child Control of a Generic Web Part has already been added with ID 'gwpgridviewForums'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: A Web Part or Child Control of a Generic Web Part has already been added with ID 'gwpgridviewForums'.
Source Error:
Line 49: sda.Fill(dt);
Line 50: gridviewGroups.DataSource = dt;
Line 51: gridviewGroups.DataBind();
Line 52: con.Close();
Line 53: }
|
Source File: d:\Project\RenSystem\Forum\Default.aspx.cs Line: 51
Stack Trace:
[InvalidOperationException: A Web Part or Child Control of a Generic Web Part has already been added with ID 'gwpgridviewForums'.]
System.Web.UI.WebControls.WebParts.WebPartManagerControlCollection.AddWebPartHelper(WebPart webPart) +817566
System.Web.UI.WebControls.WebParts.WebPartManagerControlCollection.AddWebPartsFromZone(WebPartZoneBase zone, WebPartCollection webParts) +698
System.Web.UI.WebControls.WebParts.WebPartManager.RegisterZone(WebZone zone) +343
System.Web.UI.WebControls.WebParts.WebZone.OnInit(EventArgs e) +92
System.Web.UI.WebControls.WebParts.WebPartZone.OnInit(EventArgs e) +9
System.Web.UI.Control.InitRecursive(Control namingContainer) +321
System.Web.UI.Control.InitRecursive(Control namingContainer) +198
System.Web.UI.Control.InitRecursive(Control namingContainer) +198
System.Web.UI.Control.InitRecursive(Control namingContainer) +198
System.Web.UI.Control.AddedControl(Control control, Int32 index) +2065295
System.Web.UI.ControlCollection.Add(Control child) +146
System.Web.UI.WebControls.RowControlCollection.Add(Control child) +34
System.Web.UI.ControlCollection.AddAt(Int32 index, Control child) +25
System.Web.UI.WebControls.RowControlCollection.AddAt(Int32 index, Control child) +40
System.Web.UI.WebControls.GridView.CreateRow(Int32 rowIndex, Int32 dataSourceIndex, DataControlRowType rowType, DataControlRowState rowState, Boolean dataBind, Object dataItem, DataControlField[] fields, TableRowCollection rows, PagedDataSource pagedDataSource) +161
System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +3004
System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +59
System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable data) +11
System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +111
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +29
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70
System.Web.UI.WebControls.GridView.DataBind() +4
Forum_Default.Page_Init() in d:\Project\RenSystem\Forum\Default.aspx.cs:51
System.Web.Util.CalliHelper.ArglessFunctionCaller(IntPtr fp, Object o) +5
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +781871
System.Web.UI.Control.OnInit(EventArgs e) +2069660
System.Web.UI.Page.OnInit(EventArgs e) +9
System.Web.UI.Control.InitRecursive(Control namingContainer) +321
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +692
|
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
I Need Your Help To Solve this Problem.Thanks.