User control with Property to connect to other user control


I'm a bit a newb to ASP.NET ;)

I want to create a user control which can be connected to another user control. So I did the following:

    Private IntBreadcrumbsControl As MenuControl
    <Category("CMS"), Description("Set the MenuControl that displays the breadcrumbs"), Browsable(True)> _
    Public Property BreadcrumbsControl() As MenuControl
            Return IntBreadcrumbsControl
        End Get
        Set(ByVal value As MenuControl)
            IntBreadcrumbsControl = value
        End Set
    End Property

 Unfortunately, I cannot assign a value to this property, when displaying the page, I get the error (which I only have in german ;) ):

Parserfehlermeldung: Objekt des Typs MenuControl kann nicht von seiner Zeichenfolgendarstellung mcBreadcrumbs für die BreadcrumbsControl-Eigenschaft erstellt werden.

Trying to translate: Parser error: Object of type MenuControl cannot be created of the string mcBreadcrumbs for the BreadcrumbsControl-property.

How can I solve this? The best would be, if I had a listbox to select the control on the current page in the designer.



4/2/2008 7:54:39 AM 93655 articles. 5 followers. Follow

5 Replies

Similar Articles

[PageSpeed] 17


im not sure if i understand,

if you want to dynamicly load a user  control inside a nother usercontrol,

then you need to use LoadControl method as follows:

in the parent userControl ,

dim c as control=LoadControl("~/ControltoLoad.ascx")



Hope that what you want


Anas Ghanem.

Note:Please Don't hesitate to click "Report Abuse" link if you noticed something wrong on the forums (like duplicate ,Off-topic,offensive,or any post that violates the website "TERMS OF USE"). -- Thanks!

4/3/2008 2:07:34 AM

Thanks for your post. No, that's not exactly, what I want to do. I need a property in my user control class, where I can assign another control on the current page, where the current was inserted. Not at runtime, but at design time. Something like in this screen, which I made of the property window in the ASP.NET-designer:


It's CompareValidator and for the property ControlToCompare I have all controls on the current page available. 

4/3/2008 6:36:47 AM


I'm afraid that you can't , why you dont drag and drop that user control to the target usercontrol..

what do you to accomplish here ?



Anas Ghanem.

Note:Please Don't hesitate to click "Report Abuse" link if you noticed something wrong on the forums (like duplicate ,Off-topic,offensive,or any post that violates the website "TERMS OF USE"). -- Thanks!

4/5/2008 4:11:41 PM

Ähmm ... and that should do ... what? Dragging and dropping user controls on other user controls doesn't seem to be supported by the designer. Furthermore, how does the designer know, which property it should fill with the user controll dropped on the other?

If you read my first post, the initial problem is, that I cannot link the 2 user controls. I have the property in the property editor and I can enter the name of the other user control there. But all this does result in, is that I get the described error. If I can handle this problem, it would help me a lot ...

4/7/2008 1:16:08 PM


I see that the esiest solution for this problem is to change the Proerpty to accept the UserControl VirtualPath as followS:


    Private IntBreadcrumbsControl As String
    <Category("CMS"), Description("Set the MenuControl that displays the breadcrumbs"), Browsable(True)> _
    Public Property BreadcrumbsControl() As String
            Return IntBreadcrumbsControl
        End Get
        Set(ByVal value As String)
            IntBreadcrumbsControl = value
        End Set
    End Property

 and add a PlaceHolder to the Main UserControl at the location that you want to display the BreadCrumb....

somthing like this

<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>


now ,

then in the main userControl , you can load the BreadCrumb UserControl as follow:

In main user,  page_load

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    End Sub


Now , you can set that property to the Virtual path of the USerControl that you want to load it in the PlaceHolder...

something like this : like "~/BreakCrumb.ascx"


Anas Ghanem.

Note:Please Don't hesitate to click "Report Abuse" link if you noticed something wrong on the forums (like duplicate ,Off-topic,offensive,or any post that violates the website "TERMS OF USE"). -- Thanks!

4/7/2008 1:48:25 PM

Similar Artilces:

Web User Control to Web User Control...
Hi, I have 2 User controls on a page and want Control1 to call a method of Control2. Is this Possible? Example: Con1 = Datalist showing products, each with a Quantity Box and a Button. Con2 = Repeater showing Cart Preview (name, Price) in page.aspx. When I click on the button on the DataList in Con1 it adds the item into the Session based Cart. However it does not update the Cart Preview. I need to call BindPreview() in Con2 in order to update the Cart Preview... Does that make sense? argh! any help much appreciated! PeteWeb Design Nottingham, UK Well I can call BindPreview() from m...

access controls on web user control x from web user control Y
I have 2 web users controls in a page and I would like to get or set the selected values of a few dropdown boxes on web user control X from web user control Y and I also would like to know how to access functions that are on a web user control X from a web user control Y, is this possible? How can I do it? User can access and set the values of the User Control from .aspx page through properties,using javascript and in code-behind of aspx page.The details of it are shown below Using PropertiesIf the Sample.ascx control has two textboxes and submit button.You can access the valu...

Unable to access user control's user control's function\property from another user control
Hi, I used to call an user control's user control function as stated below from my user control in ASP.Net 1.1 wucCompany.wucEmployee.GetEmployeeSomething() After migrating to ASP.Net 2.0, I am unable to use any properties/functions(even the public ones) of the user control's User control's from another user control.  The way I have to do is create property\function in wucCompany which calls the wucEmployee's property\function and call the wucDepartment.GetEmployeeSomething().Since I need to do this change in too many places, I can...

Problem in accessing web form data in user controls when create user control dynamically
HI. I have a problem using web user control. I designed a user control named NewsForm. This user control contains some web form elements like <asp:textbox>. When I add it in an .ASPX page, all things may be true. I can know which user filles in textbox (for example and other controls) <%@ Register TagPrefix="uc1" TagName="NewsForm" Src="NewsForm.ascx" %> and <UC1:NewsForm id="newsForm" runat="server"></UC1:NewsForm> But when i create it in code behined dynamically, however user control has web form controls but their value are blank for example //aspx co...

UpdatePanel within a web user control resets data of controls outside the user control
Hello, I have a usercontrol on my page which displays a running marquee text. It makes use of an UpdatePanel (within the user control) to refresh the marquee text (within the updatepanel) at periodic intervals. For this I added a timer control and its tick event as an async postback trigger for the UpdatePanel. I have a lot of textboxes and dropdown list boxes (all with runat=server) on the page outside the above user control. These are also contained in different UpdatePanels. Problem is, when the user control does a postback to refresh the marquee text, it causes some of...

User Control in a User Control
I have a first user control that contain a second user control. If I cahe the first user control can I still dynamically control the second one or it is cached with the first one therefore can not control it anymore? Thanks When your first control is cached, its rendered out and its output is stored in the cache. On every request to the page containing your control that can satisfy it from cache, the output will just simply be inserted - your first control will never be instantiated or run in that case, so the second one wont be either. Hope this helps,Mike VolodarskyProgram Manager...

Persisting data in a web user control, which contains a list of other web user controls.
 Hi All, I have a control I've created, which can have a number of child controls - also user controls - stored as an ArrayList, which can be added wither a design time or programmatically.My problem is when I add to the list programmatically, it doesn't persist them. So if I add 3 child controls in step 1 of a wizard, with the aim that those three will be visible inside the parent in step 3, what happens is that the parent has no child controls and the item count is 0.Can anyone help? Thanks in advance.Code:Parent Control Markup: <%@ Control Language="C#" Auto...

User control in a user control
Hello all, I have created a user control with some checkboxes, and public properties to get the values of these checkboxes. I have also created a second user control using the first user control; this second control also access the public properties of the first one. My problem is when I implement the second control in an aspx page, if I click at runtime the checkboxes in the first control, I am able to access its public properties from the methods of the second control but the values of these properties are wrong. while at design time, I do not have this problem. Than...

user control to user control
I have an aspx page that have a "Register" directive to two usercontrol called rptMaster.ascx and rptDetail.ascx. I'm trying to set up a Master-Detail relationship and wish for the rptMaster.ascx to trigger and event from a dropdownlist and for the rptDetail to be listening for DropDownList event. I believe I have gotten the events part okay with help from this articel but my declaration for a private statement to my rptMaster class is producing an error. I'm using beta 2 of and I 'm having trouble getting a reference TO ...

User Controls in User Controls?
I have the follow set up and it is throwing an error "Unhandled error loading module" ... is there some trick to this that I don't know?I have a project A that uses controls from project B (project B is just a project with all my user controls used through out other modules).  project A uses user control 1 from project B with out any issues at all - great.  But then I wanted to add user control 2 to user control 1 and that is when I get my error.  In fact I don't even have the user control 2 in user control 1, just when I put the register part into user control 1 is when it al...

User Control Within UserControl
If I have a user control A and then inside it a user control B embedded/referenced within it.  User Control A has a panel defined (cpeNewUser) that I want to manipulate from the code behind of User Control B based on some event that happens.So putting this in my code behind of User Control B won't work as it has no idea of cpeNewUser:cpeNewUser.Collapsed = true;So is it because only at runtime they are married up and because of this you cannot access each other's objects at compile time?  How would I get this to work becuase I'm using all user controls inside a AJAX Too...

How to access individual controls from a form containing the web user control containing those controls
 Below is a block of code in my .aspx form named default.aspx. In this form I load a web user control. I then add it to a place holder control.(Lines 3 and 4 below) So how do I access the individual controls in my web user control? I want to set the properties on those controls, but I am baffled as to how to access the control. For example I have a text label control named "label3". How do I access this control. Because for example, under certain situations I want to hide that control. ( Label3.Visible = false;)  1    if(!Page.IsPostBack) 2&nb...

Web user control inside update panel replace with another web user control
 Hi there. I have a page with a menu. an and then the content. My thing is. That i have the update panel, and inside that i have a regual panel in which i add the Web User Controls i need. Which all works fine. My problem is. That i i have a submit funcion on almoast all the Web User controls. What i would like is that i inside that update panel, can dispose the original Web user Control and then add a response Web User Control. In normal language. Is there a way that i can load one web user control into antoher and then disposose the original? Thanks in advance hello. well, what ...

User Controls: How to change the Property of a User Control in CodeBehind???
Hi I am using the book "ASP.NET Unleasd" to learn ASP.NET. In Chapter 5 it talks about User Controls.  I am currently working on "Listing 5.7": Exposing properties and Methods in user controls.Well, I am trying to implement this code in visual studio using codebehind.In the user control (HeaderTitle.ascx) I have the following:<html><head><title><%=PageTitle%></title></head><body><h2>Global Super Company</h2><i>We mean business</i><hr>In the file HeaderTitle.ascx.cs (code behind for the user control) I have the ...

Web resources about - User control with Property to connect to other user control -

Property - Wikipedia, the free encyclopedia
This article may require copy editing for grammar, style, cohesion, tone, or spelling . You can assist by editing it . In abstract, property ...

Property - Wikipedia, the free encyclopedia
In abstraction, property is that which belongs to or with something, whether as an attribute or as a component of said thing. For the significant ...

RBA governor Glenn Stevens welcomes slowing property market
The easing of property markets is welcome and essential says RBA governor Glenn Stevens.

Melbourne Anarchist Club in battle with property developers
The Melbourne Anarchist Club &ndash; home to a group of social outliers who reject &quot;hierarchical power structures&quot; and believe profit ...

China stocks rise, led by property shares - DailyTelegraph Search Search
CHINA stocks have climbed, led by property and resources shares, amid signs that insurers are scrambling for stakes in real estate majors and ...

China stocks rise, led by property shares
CHINA stocks have climbed, led by property and resources shares, amid signs that insurers are scrambling for stakes in real estate majors and ...

Basics key to selling Perth property, says new report - PerthNow Search Search
HOMES with water views might net a million-dollar return, but practical features such as a double lockup garage and a short commute to work make ...

Chinese demand for Aussie property drops as much as 15%, McGrath says
Chinese demand for Australian homes has dropped as much as 15 per cent from a year earlier as China's stocks tumbled and the economy slowed, ...

Men face court after $30,000 worth of suspected stolen property seized in Griffith
Two men are set to face the ACT Magistrates Court on Saturday morning in relation to stolen property and burglary charges.

Vandals spray-paint Hawthorne mosques, leave fake grenade on property
Two mosques in Hawthorne were vandalized and police say both incidents are being investigated as hate crimes.

Resources last updated: 12/17/2015 1:49:19 PM