.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Issue with webparts inside usercontrol

Posted By:      Posted Date: October 10, 2010    Points: 0   Category :ASP.Net

Iam using an usercontrol with webparts added to it.

In some specific scenarios i need to load the same user control multiple times.

Its not allowing to add more that one time showing up the error message webpart zone-id already added.

If am using that usercontrol without webparts iam able to add multiple times with out any error message.

How can i resolve this issue with webparts .

Please help me out

View Complete Post

More Related Resource Links

Repeater issue, all code inside Repeater are not shown


I have a Repeater who should show some data from my ms.sql server. But all code inside the Repater is not shown on my .aspx page. What am i doing wrong. I have a similar Repeater on another page and there it works fine.


 <div class="AnsaettelseKontrakt Folders">
      	            <table cellpadding="0" cellspacing="0" width="750px" align="right">
                            <th class="BrugerHeader" style="width:300px;">Filnavn</th>
                            <th class="BrugerHeader" style="width:80px;">Størrelse</th>
                            <th class="BrugerHeader" style="width:150px;">Dato</th>
                            <th class="BrugerHeader" style="width:180px;" colspan="2">Brugere</th>
                            <th class="BrugerHeader" style="width:40px;">Værktøjer</th>
                        <asp:Repeater ID="RepeaterAns" runat="server" onitemcommand="Repeater1_ItemCommand" >
                                <tr class="Br

Web zone inside of a web usercontrol.

Hi guys, I need to add web zones to a user control where the users can added web part inside of the webusercontrol.ascx. I have try many ways but it does not work. Does Someone have some idea how to have a user control where users can add web part inside of it? Thanks!! HANK    

Tab panel inside usercontrol cut off in ie6 and ie7

Hi,can anyone shed me some light on this issue.I use the tabpanel and place it in a usercontrol. but the text in the tab header are cut off when opened in IE6 and IE7. in mozilla this is working properly. i am loading this usercontrol in a webpart so i can add it in any page in my site.can someone help me. Thanks

.NET 4.0: Inside UserControl Menu.Items.Add(...) cause 'HttpException (0x80004005)'


When using .NET 4.0 there seems to be an issue - inside any UserControl Menu.Items.Add(...) cause 'HttpException (0x80004005)':


The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
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.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Stack Trace:

[HttpException (0x80004005): The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).]
   System.Web.UI.ControlCollection.Add(Control child) +11242224
   System.Web.UI.Control.PreRenderRecursiveInternal() +113
   System.Web.UI.Control.PreRenderRecursiveInternal() +222
   System.Web.UI.Control.PreRenderRecursiveInternal() +222

How to change the page(aspx) title from Usercontrol(ascx) the inside the page(aspx) (asp.net 1.1) ??




I have user control(ascx) inside  the page(aspx) and from the code behind of that user control How can I change the page(aspx) title??


Note : Please my Question about asp.net 1.1


And thanks with my best regarding


Issue with dynamic usercontrol loading when using ParseControl() method in VS2008


In the process of migrating an old VS2003 web app to VS2008, I'm running into this issue and haven't been able to find a resolution. 

Sample code:

"Default.aspx" has a PlaceHolder(ToolHeader).  In the Page_Load(), we dynamically load a user control passing in the virtual path to a helper method [public Control ParseUserControl(string virtualPath)].  This reads the content from the physical path, returns a Control from ParseControl() method. 

 I immediately get the following error when I open the default.aspx page in browser.

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type 'DynamicUC.UcControl'.

Source Error:

 Line 1:  <%@ Control AutoEventWireup="true" CodeBehind="UcControl.ascx.cs" Inherits="DynamicUC.UcControl"  %>

Can't figure out why it can't load the type.  Namespaces are looking right.   I try removing the Inherits="DynamicUC.UcControl" attribut

Grid Inside StackPanel Sizing Issue


Hello All,


  I'm fairly new to WPF and I'm having an issue with a layout I'm trying to accomplish. I have pasted the XAML below. Briefly I have a Grid inside a stackpanel in which the grid has 3 stack panels nested below. The Grid in question is Named DetailGrid, which is not sizing correctly. In fact it's not stretching at all and is causing issues with some drag and drop functionality.The layout I'm trying to achieve is a Header/Body layout, where the header remains the same and the body is dynamic content based upon objects the user chooses to place on the detail grid/stackpanels. I know this may not be the best choice of controls for this layout, but the functionality of having all the children contrlols move dynamically when the expanders are expanded and collapsed is a desired function of the application.

Any Recommendations are greatly appreciated.


<Window x:Class="AtlasConsole.ConsoleHeader"

Hide userControl inside the user controls' button Click



I created simple web usercontrol ABC with Yes/No button.In Current pages submit Button Click it popup's ABC user control. ABC user controls Yes button Click it executes some serverside function.But I want to close/hide this user control after the Yes button Click ( like confirm box in javascript).But its not hiding after setting the visible property to false. Is there any way to implement this...


Combobox inside Listbox binding issue

I am lost...

I have the following two classes (simplified)

Class Parent
    String Description{get;set;} 
    ObservableCollection<Children> ListOfChildren = new ObservableCollection<Children>();

Class Children
    public string Name{get;set;}

And the following two lists :

public List<Parent> ListOfParents = new List<Parent>();
public static List<Children> StaticListOfChildren=new List<Children>();

Now I have a list in XAML, I set the datacontext of this list to the "ListOfParents" (in code) and set the ItemSource="{Binding}"
All works fine so far. Inside this list I have another list containing the "ListOfChildren" list. The itemtemplate of this list contains a combobox. This combobox binds to the "StaticListOfChildren" list. The problem is now I can't get the selecteditem of the combobox to bind to the Children item in the ListOfChildren.... Can anyone help ??

<ListBox x:Name="lbMaterialsBuildup" HorizontalContentAlignment="Stretch" ItemsSource="{Binding}">

UserControl Visibility binding Issue.

<UserControl x:Class="Org.Intermountain.ICM.Views.Authentication.LoginFormView"
             d:DesignHeight="636" d:DesignWidth="946"
             IsEnabled="{Binding IsControlEnabled}" 

UserControl inside SharePoint Content Page - Unexpected Error


Hello Everyone,

 I have created a Page using Sharepoint Designer (without association it to any MasterPage. Then I registered a user control Inside this which is working perfectly fine:

<%@ Page Language="C#" %>
<%@ Register src="~/_controltemplates/mDart2.0/FetchDataFromAit.ascx" TagName="ActionItems" TagPrefix="wssuc" %>
<html dir="ltr" xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">

<head runat="server">
<META name

Accessing the different controls inside a GridView control

how we can access a particular control which resides inside a GridView control. In this article I will show you how you can access different controls inside a GridView control. We will see how we can access a TextBox control, a DropDownList control and a ListBox control. If you are working with ASP.NET 1.X then you might want to check out my article Accessing Different Controls Inside a DataGrid.

How To Add calendar control inside a GridView

This article show hot to add calendar control inside a GridView with code in c#

Using ATLAS PopUp Control with Calendar inside the GridView Control

In this video tutorial Mohammad demonstrates how you can access the Calendar control which is displayed using the ATLAS PopUp control inside the GridView control.

RadioButton inside GridView, How to get it work as normal

Did you tried before to drag a RadioButton control inside a Gridivew templatefield, and then you attempt to select these RadioButtons , you will notice that the behavior of RadioButton control will be changed and it will work just like the behavior of checkbox control! the user will be able to select more than one radiobutton in the grid!

Maintain HTML Radio Button Selection Inside GridView After Postback

Long time ago I wrote an article about getting the value of the selected RadioButtons inside the GridView control. The code did not addresssed the postback issue which means that the selected radio button was cleared after the postback occurs.

Write Custom WebParts for SharePoint 2007

The popularity of SharePoint Portal Server 2003 led Microsoft to tightly integrate the next SharePoint version, Microsoft Office SharePoint Server (MOSS) 2007, with its ASP.NET 2.0 WebPart framework. This tight integration enables the ASP.NET and SharePoint developer to do a number of things that previously weren't possible
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend