CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML





Zone: > NEWSGROUP > Asp.Net Forum > windows_hosting.hosting_open_forum Tags:
Item Type: NewsGroup Date Entered: 3/11/2004 3:27:50 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 7 Views: 23 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
8 Items, 1 Pages 1 |< << Go >> >|
echo88
Asp.Net User
communication between user controls nested in a user control3/11/2004 3:27:50 AM

0/0

Okay-
trying to do this but not sure if I can .


I want to build one user control that contains 1-10 user controls within. But how can I communicate between children user controls. Maybe I am a little lost without Intellisense. Anyway, if can provide me with a quick example in C# - I would appreciate it. Could I just reference controls individually by their "ID"s ?

Thanks in advance.
2 wrongs don't make a right - but three lefts do
master4eva
Asp.Net User
Re: communication between user controls nested in a user control3/14/2004 8:02:42 AM

0/0

You could do something like this:

foreach (Control c in Parent.Controls) {
if (c is UserControl) {
// communicate
}
}

Or:

UserControl c = Parent.FindControl("IDofSiblingControl");

-- Justin Lovell
echo88
Asp.Net User
Re: communication between user controls nested in a user control3/16/2004 2:33:01 PM

0/0

THanks!!! Can you help me with another question on the same topic ( almost ). each of the sibling controls have 3 buttons. but only one control is displayed. When a children control button is clicked it does a postback - which I dont want to do. I Reason because on page load I hide all but one child control andif they are working with anther child control and click a button it will the current child control and move back to the start control. The button just run DB queries and populate fields. I have already set Autopostback to false - what else can I do?
2 wrongs don't make a right - but three lefts do
master4eva
Asp.Net User
Re: communication between user controls nested in a user control3/16/2004 4:48:54 PM

0/0

Sorry but you are ambigious on this line at it throws me off understanding for the rest of the post:

:: I Reason because on page load I hide all but one child control andif they are working with anther child control and click a button it will the current child control and move back to the start control.

The problem I am having is that all of them are controls and when you say "one control" - what is it referring to: the user control or the button? So could you clarify it clearer?
-- Justin Lovell
echo88
Asp.Net User
Re: communication between user controls nested in a user control3/16/2004 7:19:45 PM

0/0

Sorry - when I say controls I meant User Controls. so basically I have a parent user control - five children user controls and within each 3 buttons server controls. Only one children control is to be visible - the rest on hidden unti l their "Tab" is clicked. Then that one control is visible and the other are hidden.

My problem is if the click on a button on any of other ( but default ) child user controls - it seems to perform a postback and hides all the other ones including the active one - I don't even thyink it performs the function I assigned to the click event.

2 wrongs don't make a right - but three lefts do
master4eva
Asp.Net User
Re: communication between user controls nested in a user control3/17/2004 1:32:59 PM

0/0

Checklist:

1) Are you assigning ID's to the child user controls?
2) How are you putting the other controls to "not visible" (poorly said, I know): are you using the Visible property or someother mechanism?
3) When you do the loading of the controls, do you set everyone's visibility to hidden and then assign the "active" user control?
-- Justin Lovell
echo88
Asp.Net User
Re: communication between user controls nested in a user control3/17/2004 10:43:10 PM

0/0

Yes, Yes and Yes. Exactly! - problem is not keeping the "active" children user control so "active." So if they are working in any of the child user controls and click a button - it does the intial setup procedure and hides all and activates the default child user control. I want it to not even take a trip to the server ( seems like it is - even though I set all the buttons autopostback to false ).

Oh - each child user control is set inside a table cell- basically I trying to emulate the windows tab control. Maybe there is a better way. when I tab is click the body is displayed and the others are hidden. But again the if you click a button inside the user control - the default tab is activated.


Thanks again

2 wrongs don't make a right - but three lefts do
master4eva
Asp.Net User
Re: communication between user controls nested in a user control3/18/2004 12:02:51 PM

0/0

Ok, there is only one mechanism that you will have to change (the visible part). That is to have another property called "RenderToClient". And you will have to control the rendering a bit. So your code should look something like this:

private bool pRenderToClient = false;

public bool RenderToClient {
get { return pRenderToClient; }
set { pRenderToClient = value; }
}

protected override void Render(HtmlTextWriter writer) {
if (RenderToClient)
base.Render(writer);
}

-- Justin Lovell
8 Items, 1 Pages 1 |< << Go >> >|



Search This Site:


Meet Our Sponsors:



Other Resources:

How to get values from user control onto .aspx page - ng.asp-net-forum ... CodeProject: Mastering Page-UserControl Communication. Free source ... How to implement nested Web user controls in ASP.NET by using Visual ...
ng.asp-net-forum.community-jobs - Web Programming Newsgroups communication between user controls nested in a user control ... active x control error"automation server can't create object" ...
Help - Special characters in user IDs and passwords. Integrating ... Communication between the Producer and Consumer portals. Using your portal as a WSRP Producer ...
CodeProject: Embedding Controls in a ListView. Free source code and ... User Controls. Validation. View State. WAP / WML. Web Security. Web ... When you're intending to embed a control in a ListView, you'll have to make sure ...
Private Communication Between Components in Assemblies User Assistance for Components. Control Authoring for Windows Forms. Private Communication Between Components in Assemblies. MSDN Library ...
Method an apparatus for specification of communication parameters ... In this case a user issues network control commands which result in changes in a ... user that the task being addressed is communication between the user's system ...
User controlled dialog resource switching in a multi-tasking word ... ... an operating system construct which controls the rate of progress of ... between the operating system information necessary to control, constitute, ...
Citations: Visual Specification of Interprocess and Intraprocess ... ... communication, etc. patterns to be performed have to be extracted from the user ... between two graphics object attributes by drawing a connection line ...




good custom module creation reference guide?

how many sitemap files can i use ?

requested registry access is not allowed.

help with setting up custom dnn templates in vs 2002

getting a strange error when trying to edit a module. see bottom post. no 'edit webfilter settings' menu option is showing up in the actions menu either...

same adminuser in several sites but not all of them

displaying hierarchial data from a database in a treeview in internet explorer 7

announcment description. how do i add a carriage return and line feed

making dnn2 pa, getting error

redirection problem

3.0.13 - container removal

user keeps getting logged out unexpectedly

vs project reference problem

persist custom property of a webcontrol

tough security question using system.security.cryptography.rijndaelmanaged.

error message creating treeview

ssl- fallen off the map?

question about web parts

disappearafter vs javascript settimeout

minimize webpartzone programatically

 
All Times Are GMT