Click here to Skip to main content
15,901,368 members
Home / Discussions / C#
   

C#

 
GeneralRe: Logging on Removable Device Pin
wenlong8822-Oct-10 17:24
wenlong8822-Oct-10 17:24 
AnswerRe: Logging on Removable Device Pin
_Erik_22-Oct-10 4:20
_Erik_22-Oct-10 4:20 
GeneralRe: Logging on Removable Device Pin
Dave Kreskowiak22-Oct-10 13:27
mveDave Kreskowiak22-Oct-10 13:27 
GeneralRe: Logging on Removable Device Pin
_Erik_22-Oct-10 22:34
_Erik_22-Oct-10 22:34 
GeneralRe: Logging on Removable Device Pin
Dave Kreskowiak23-Oct-10 7:46
mveDave Kreskowiak23-Oct-10 7:46 
GeneralRe: Logging on Removable Device Pin
wenlong8822-Oct-10 17:22
wenlong8822-Oct-10 17:22 
QuestionReference a method from one user control from within another user control? Pin
Ian Durward21-Oct-10 15:17
Ian Durward21-Oct-10 15:17 
AnswerRe: Reference a method from one user control from within another user control? [modified] Pin
Karthik. A21-Oct-10 16:46
Karthik. A21-Oct-10 16:46 
I don't have Visual Studio in the laptop I am currently using. But this should work. Main thing is that you will get the idea as to how to do this.

Assume you the following 2 user controls in your .aspx

ParentPage.aspx

<%@ Register src="Control1.ascx" TagPrefix="uc" TagName="Control1" %>
<%@ Register src="Control2.ascx" TagPrefix="uc" TagName="Control2" %>

<uc:Control1 runat="server" ID="ctrl1" />

<uc:Control2 runat="Server" ID="ctrl2" />


ParentPage.aspx.cs

public partial class ParentPage : Page
{

public Control1 getControl1()
{
	return ctrl1;
}

public Control2 getControl2()
{
	return ctrl2;
}

}


In the user control you could do the following:

Control1.ascx.cs

public partial class Control1 : UserControl
{
public void Page_Load(...)
{
	ParentPage myPage = (ParentPage)this.Parent;
	Control2 ctrl2 = myPage.getControl2();
	// start using ctrl2!	
}
}


Hope you understand this. Else post your questions here, when I get to a computer w/ VS, should be a lot easier!

[Edit] While answering this I assumed that you are referring to a web page. This wouldn't be the same for a win forms app (just now i noticed you have said "window" and not "page" and that this is the C# forum and not the ASP.Net forum). But the idea would be similar - instead of page, you would be getting the Form's instance (the parent) which exposes 2 methods to return the user control id's, thereby enabling you to call that control's methods.
Cheers,
Karthik
modified on Thursday, October 21, 2010 11:01 PM

AnswerRe: Reference a method from one user control from within another user control? Pin
Ravi Bhavnani21-Oct-10 17:19
professionalRavi Bhavnani21-Oct-10 17:19 
AnswerRe: Reference a method from one user control from within another user control? Pin
_Erik_22-Oct-10 4:50
_Erik_22-Oct-10 4:50 
GeneralRe: Reference a method from one user control from within another user control? Pin
Ian Durward22-Oct-10 8:18
Ian Durward22-Oct-10 8:18 
GeneralRe: Reference a method from one user control from within another user control? Pin
_Erik_22-Oct-10 23:39
_Erik_22-Oct-10 23:39 
QuestionGWT-RPC call from c# .net (google keywords tool external) help Pin
sodevrom21-Oct-10 14:39
sodevrom21-Oct-10 14:39 
AnswerRe: GWT-RPC call from c# .net (google keywords tool external) help Pin
Luc Pattyn21-Oct-10 15:22
sitebuilderLuc Pattyn21-Oct-10 15:22 
GeneralRe: GWT-RPC call from c# .net (google keywords tool external) help Pin
sodevrom22-Oct-10 4:05
sodevrom22-Oct-10 4:05 
GeneralRe: GWT-RPC call from c# .net (google keywords tool external) help Pin
jobs200120-Dec-10 23:16
jobs200120-Dec-10 23:16 
GeneralRe: GWT-RPC call from c# .net (google keywords tool external) help Pin
jobs200120-Dec-10 23:24
jobs200120-Dec-10 23:24 
QuestionEvent handling Pin
Tichaona J21-Oct-10 5:39
Tichaona J21-Oct-10 5:39 
AnswerRe: Event handling Pin
OriginalGriff21-Oct-10 5:51
mveOriginalGriff21-Oct-10 5:51 
AnswerRe: Event handling Pin
Luc Pattyn21-Oct-10 5:55
sitebuilderLuc Pattyn21-Oct-10 5:55 
AnswerRe: Event handling Pin
_Erik_21-Oct-10 6:05
_Erik_21-Oct-10 6:05 
GeneralRe: Event handling Pin
OriginalGriff21-Oct-10 8:21
mveOriginalGriff21-Oct-10 8:21 
GeneralRe: Event handling Pin
_Erik_21-Oct-10 9:46
_Erik_21-Oct-10 9:46 
GeneralRe: Event handling Pin
OriginalGriff21-Oct-10 9:50
mveOriginalGriff21-Oct-10 9:50 
QuestionX / OK intercetption Pin
neverpleat21-Oct-10 3:08
neverpleat21-Oct-10 3:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.