Click here to Skip to main content
15,915,611 members
Home / Discussions / C#
   

C#

 
QuestionPage refresh Pin
juman_achu21-Oct-10 23:15
juman_achu21-Oct-10 23:15 
AnswerRe: Page refresh Pin
Łukasz Nowakowski21-Oct-10 23:27
Łukasz Nowakowski21-Oct-10 23:27 
GeneralRe: Page refresh Pin
juman_achu21-Oct-10 23:33
juman_achu21-Oct-10 23:33 
GeneralRe: Page refresh Pin
Łukasz Nowakowski21-Oct-10 23:34
Łukasz Nowakowski21-Oct-10 23:34 
GeneralRe: Page refresh Pin
juman_achu21-Oct-10 23:40
juman_achu21-Oct-10 23:40 
GeneralRe: Page refresh [modified] Pin
thatraja21-Oct-10 23:58
professionalthatraja21-Oct-10 23:58 
QuestionI am confused with Delegates, Events and Threads Pin
rahul.kulshreshtha21-Oct-10 20:15
rahul.kulshreshtha21-Oct-10 20:15 
AnswerRe: I am confused with Delegates, Events and Threads [modified] Pin
Sivaraman Dhamodharan21-Oct-10 20:58
Sivaraman Dhamodharan21-Oct-10 20:58 
GeneralRe: I am confused with Delegates, Events and Threads Pin
rahul.kulshreshtha21-Oct-10 21:45
rahul.kulshreshtha21-Oct-10 21:45 
GeneralRe: I am confused with Delegates, Events and Threads Pin
Sivaraman Dhamodharan21-Oct-10 23:16
Sivaraman Dhamodharan21-Oct-10 23:16 
AnswerRe: I am confused with Delegates, Events and Threads PinPopular
DaveyM6921-Oct-10 21:29
professionalDaveyM6921-Oct-10 21:29 
GeneralRe: I am confused with Delegates, Events and Threads Pin
rahul.kulshreshtha21-Oct-10 21:50
rahul.kulshreshtha21-Oct-10 21:50 
AnswerRe: I am confused with Delegates, Events and Threads Pin
Sauro Viti21-Oct-10 23:29
professionalSauro Viti21-Oct-10 23:29 
QuestionLogging on Removable Device Pin
wenlong8821-Oct-10 19:22
wenlong8821-Oct-10 19:22 
AnswerRe: Logging on Removable Device Pin
Dave Kreskowiak22-Oct-10 0:59
mveDave Kreskowiak22-Oct-10 0:59 
GeneralRe: Logging on Removable Device Pin
wenlong8822-Oct-10 2:05
wenlong8822-Oct-10 2:05 
GeneralRe: Logging on Removable Device Pin
Dave Kreskowiak22-Oct-10 13:26
mveDave Kreskowiak22-Oct-10 13:26 
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

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.