473,396 Members | 1,998 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,396 software developers and data experts.

Access to parent objects

SOS
Hi guys ,
i create a custom control and place it on a web form,
how can i access to this web form from my custom control ?

for example i want to add a button to this webform by writing code in my
custom control.

Thanx :)
Nov 18 '05 #1
4 1382
Hi,

via Page property of your control (which it has by default) you can access
the top-level Page object from which you can search child controls with
FindControl method.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke
"SOS" <SO*@hotmail.com> wrote in message
news:O1*************@TK2MSFTNGP11.phx.gbl...
Hi guys ,
i create a custom control and place it on a web form,
how can i access to this web form from my custom control ?

for example i want to add a button to this webform by writing code in my
custom control.

Thanx :)

Nov 18 '05 #2
All web controls inherit a .Parent property.

"SOS" <SO*@hotmail.com> wrote in message
news:O1*************@TK2MSFTNGP11.phx.gbl...
Hi guys ,
i create a custom control and place it on a web form,
how can i access to this web form from my custom control ?

for example i want to add a button to this webform by writing code in my custom control.

Thanx :)

Nov 18 '05 #3
SOS
Thanks
but when i use of this property in my class constructer
i get this error : Object reference not set to ...
"Rick Spiewak" <ri*********@mindspring.com> wrote in message
news:eD**************@tk2msftngp13.phx.gbl...
All web controls inherit a .Parent property.

"SOS" <SO*@hotmail.com> wrote in message
news:O1*************@TK2MSFTNGP11.phx.gbl...
Hi guys ,
i create a custom control and place it on a web form,
how can i access to this web form from my custom control ?

for example i want to add a button to this webform by writing code
in my
custom control.

Thanx :)


Nov 18 '05 #4
The parent won't exist until you add your control to the page's or form's
controls collection.

"SOS" <SO*@hotmail.com> wrote in message
news:eM**************@TK2MSFTNGP10.phx.gbl...
Thanks
but when i use of this property in my class constructer
i get this error : Object reference not set to ...
"Rick Spiewak" <ri*********@mindspring.com> wrote in message
news:eD**************@tk2msftngp13.phx.gbl...
All web controls inherit a .Parent property.

"SOS" <SO*@hotmail.com> wrote in message
news:O1*************@TK2MSFTNGP11.phx.gbl...
Hi guys ,
i create a custom control and place it on a web form,
how can i access to this web form from my custom control ?

for example i want to add a button to this webform by writing code

in
my
custom control.

Thanx :)



Nov 18 '05 #5

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

Similar topics

49
by: Yannick Turgeon | last post by:
Hello, We are in the process of examining our current main application. We have to do some major changes and, in the process, are questionning/validating the use of MS Access as front-end. The...
6
by: AAJ | last post by:
Hi all I have a listbox on a form. If I set its rowsource directly, and the query in the rowsourse returns no data, then the displayed listbox is empty (exactly as you would expect) ...
1
by: Chris Ashley | last post by:
Say I have a class called TabManager, which has an array of Tab objects? There is no inheritance or other relationship between them apart from the TabManager instantiating the tab objects and...
3
by: Mark Denardo | last post by:
Hi I have an app that has a number of textboxes (richtextboxes to be exact) that get created dynamically and I add a few at a time to panel controls (so I can flip a group in and out when I want). ...
4
by: lars.uffmann | last post by:
Hey everyone! I am (still) working on a project that I took over from former students, so don't blame me for the criminal approach on coding *g* The problem I have is fairly easy and while I...
0
by: Olivier Salzgeber | last post by:
Hello everybody I have an application which is grouped in a MainApplication and several Modules (DLL's) The Main Application is basically a Form with a NavigationBar on the Left Side (like in...
10
by: Goran Djuranovic | last post by:
Hi all, Does anyone know how to declare a variable in a class to be accessible ONLY from a classes instantiated within that class? For example: ************* CODE ***************** Public...
6
by: reandeau | last post by:
I'm building out a OO based app in PHP 5 but I'm getting a little confused on children contructing parents. I have a parent that looks like this: abstract Class State { protected $database;...
1
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
Hello, I'm sorry for such a basic question, but here it is: I'm creating a VS2005 C# forms application. In the parent form I have a button that opens a child form. In the code for the parent...
3
by: palepimp | last post by:
Hello all, I have searched far and wide for a solution to my issue. In short, here is the problem: 1. 3 PC's enter data into an Access 2003 database (PC's are running Vista w/ Office 2007...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.