473,385 Members | 1,400 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Calling parent methods from a child

Jim
I have a user control that has two nested user controls within it. I have a
method in the parent called CloseDetailsMaint, and I need to be able to call
it from one of the child user controls that is nested within the parent. How
do I do this?
Nov 19 '05 #1
5 1784
Parent.Page
You may have to cast it, and make sure it's set to Public in the parent

--
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Jim" <Ji*@discussions.microsoft.com> wrote in message
news:21**********************************@microsof t.com...
I have a user control that has two nested user controls within it. I have
a
method in the parent called CloseDetailsMaint, and I need to be able to
call
it from one of the child user controls that is nested within the parent.
How
do I do this?

Nov 19 '05 #2
Jim
I tried Parent. Page.CloseDetailsMaint ();, but I got an exception during the
build saying that System.Web.UI.Page does not contain a definition for
"CloseDetailsMaint". Any ideas? The method is public and returns void.

"Curt_C [MVP]" wrote:
Parent.Page
You may have to cast it, and make sure it's set to Public in the parent

--
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Jim" <Ji*@discussions.microsoft.com> wrote in message
news:21**********************************@microsof t.com...
I have a user control that has two nested user controls within it. I have
a
method in the parent called CloseDetailsMaint, and I need to be able to
call
it from one of the child user controls that is nested within the parent.
How
do I do this?


Nov 19 '05 #3
((MyParentPage)Page).CloseDetailsMaint ();

"Jim" <Ji*@discussions.microsoft.com> pí¹e v diskusním pøíspìvku
news:4D**********************************@microsof t.com...
I tried Parent. Page.CloseDetailsMaint ();, but I got an exception during
the
build saying that System.Web.UI.Page does not contain a definition for
"CloseDetailsMaint". Any ideas? The method is public and returns void.

"Curt_C [MVP]" wrote:
Parent.Page
You may have to cast it, and make sure it's set to Public in the parent

--
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Jim" <Ji*@discussions.microsoft.com> wrote in message
news:21**********************************@microsof t.com...
>I have a user control that has two nested user controls within it. I
>have
>a
> method in the parent called CloseDetailsMaint, and I need to be able to
> call
> it from one of the child user controls that is nested within the
> parent.
> How
> do I do this?


Nov 19 '05 #4
You can Raise an Public Event in the child control, and this event is
implemented in the parent control, and there you can call the method you
need.

Atte. Elmer Carías
"Jim" <Ji*@discussions.microsoft.com> wrote in message
news:21**********************************@microsof t.com...
I have a user control that has two nested user controls within it. I have a method in the parent called CloseDetailsMaint, and I need to be able to call it from one of the child user controls that is nested within the parent. How do I do this?

Nov 19 '05 #5
Jim,
While you've gotten your answer from others,you might want to take a look at
http://openmymind.net/communication/index.html which discusses strategies
to do this sort of thing.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Jim" <Ji*@discussions.microsoft.com> wrote in message
news:21**********************************@microsof t.com...
I have a user control that has two nested user controls within it. I have a method in the parent called CloseDetailsMaint, and I need to be able to call it from one of the child user controls that is nested within the parent. How do I do this?

Nov 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: pablo | last post by:
Dear NewsGroupers, I am relatively new to OOP and cannet get my head around this problem. I have two classes. Class Child extends Parent. There is no constructor for the Child class. So when I...
14
by: Axel Straschil | last post by:
Hello! Im working with new (object) classes and normaly call init of ther motherclass with callin super(...), workes fine. No, I've got a case with multiple inherance and want to ask if this...
5
by: Da Costa Gomez | last post by:
Hi, I was wondering whether someone could shed some light on the following. Using inheritance in Java one can override a function f() (or is it overload?) in the child and then do: public f() {...
14
by: Michael Winter | last post by:
In an attempt to answer another question in this group, I've had to resort to calling the DOM method, Node.removeChild(), using a reference to it (long story...). That is, passing Node.removeChild....
9
by: Martin Herbert Dietze | last post by:
Hello, I would like to implement a callback mechanism in which a child class registers some methods with particular signatures which would then be called in a parent class method. In...
2
by: Andrea Gavana | last post by:
Hello NG, this may seem a stupid (or even impossible) question, but my knowlegde of Python is quite limited. I have basically a simple graphical user interface that contains a Panel, another...
1
by: h | last post by:
I have a custom control that consist of one or more custom child controls (I made a custom List control, where each list item is a group of a text and button controls). When I resize one "child"...
0
by: Carlitos | last post by:
Hi there, I apologize if it is not the right forum to post this question, but it has to do with C#, HTML and javascript altogether. I programmed a windows form custom control in C# which...
10
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the...
1
by: =?Utf-8?B?cmFuZHkxMjAw?= | last post by:
The code below is pretty simple. Calling Talker() in the parent returns "Parent", and calling Talker() in the child returns "Child". I'm wondering how I can modify the code so that a call to the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.