473,401 Members | 2,127 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,401 software developers and data experts.

ASP.NET: Web User Control calling functions in page?

Hi All,

I have a Web User Control that I would like to use in several pages in
my ASP.NET application.

I'm wondering, however, if it's possible to call a function contained
in the page from within the Web User Control?

To give a little more detail:

The Web User Control itself adds and displays notes associated with an
order. When the submit button in the control is clicked, I need to call
a function that refreshes the overall data being displayed for the
order on the page. This function is called by other events as well, so
it doesn't make sense to include it within the Web User Control itself.

So, I'm wondering a) if it's possible to call a function defined in the
page in which the Web User Control is included, and b) if it is
possible, what the syntax for that would be?

Any help would be much appreciated!

Much warmth,

planetthoughtful
---
"Lost in thought"
http://www.planetthoughtful.org

Aug 7 '06 #1
2 2340
plantethoughtful,

In your control, you can access the Page property, which will return the
Page that the control is hosted in. You would then have to cast it to the
specific page type, so that you can access the functions that you have
defined in your page.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"planetthoughtful" <pl**************@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
Hi All,

I have a Web User Control that I would like to use in several pages in
my ASP.NET application.

I'm wondering, however, if it's possible to call a function contained
in the page from within the Web User Control?

To give a little more detail:

The Web User Control itself adds and displays notes associated with an
order. When the submit button in the control is clicked, I need to call
a function that refreshes the overall data being displayed for the
order on the page. This function is called by other events as well, so
it doesn't make sense to include it within the Web User Control itself.

So, I'm wondering a) if it's possible to call a function defined in the
page in which the Web User Control is included, and b) if it is
possible, what the syntax for that would be?

Any help would be much appreciated!

Much warmth,

planetthoughtful
---
"Lost in thought"
http://www.planetthoughtful.org

Aug 7 '06 #2

Nicholas Paldino [.NET/C# MVP] wrote:
plantethoughtful,

In your control, you can access the Page property, which will return the
Page that the control is hosted in. You would then have to cast it to the
specific page type, so that you can access the functions that you have
defined in your page.

Hope this helps.
Hi Nicholas,

Thanks for this - I'm not sure exactly how I cast the page object as
the specific page type? Any advice on where I'd look to read about
doing this?

Many thanks!

Much warmth,

planetthoughtful
---
"Lost in thought"
http://www.planetthoughtful.org

Aug 7 '06 #3

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

Similar topics

10
by: David Davidson | last post by:
I am attempting to use CreateProcessWithLogonW from the server-side code of a web page (yes, I want to create a process on the server) and not having much luck. I am attempting to run VPScan, an...
4
by: louise raisbeck | last post by:
Resending this as own topic as didnt get answer from original. Would be grateful for a response from anyone that knows. Thanks. Hi there, I found your post really helpful..but i wondered if, once...
5
by: Lyle Fairfield | last post by:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/callnetfrcom.asp The Joy of Interoperability Sometimes a revolution in programming forces you to abandon all...
6
by: David Hearn | last post by:
I have a property in a user control that I am setting: Private strPageName as String Public Property PageName() as String Get Return strPageName End Get Set(byVal Value as String)...
4
by: David Hearn | last post by:
I need to pass some variables to a user control so that some functions that are in it can use them. I am trying to set a public property that I have in it but it isn't working for some reason and I...
2
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
0
by: shamirza | last post by:
· When was .NET announced? Bill Gates delivered a keynote at Forum 2000, held June 22, 2000, outlining the .NET 'vision'. The July 2000 PDC had a number of sessions on .NET technology, and...
0
by: shamirza | last post by:
· What is view state and use of it? The current property settings of an ASP.NET page and those of any ASP.NET server controls contained within the page. ASP.NET can detect when a form is requested...
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: 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
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
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.