473,804 Members | 3,259 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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,

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

Aug 7 '06 #1
2 2359
plantethoughtfu l,

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.co m

"planetthoughtf ul" <pl************ **@gmail.comwro te in message
news:11******** **************@ h48g2000cwc.goo glegroups.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,

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

Aug 7 '06 #2

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

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,

planetthoughtfu l
---
"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
5407
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 unsupported command-line virus scanner from Symantec, to check an uploaded file for viruses. At first, I wrapped VPScan with a DLL and ran it as a COM+ component and found that it would work only when someone was logged on and it was set to run...
4
2518
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 I have exposed a public property containing the value of a textbox in a user control..how do I grab this from the calling page? I cant think of the syntax, since my page doesnt know the contents of the class (and therefore, the public...
5
2693
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 that's come before. To take an extreme example, suppose you have been writing Visual Basic applications for years now. If you're like many developers, you will have built up a substantial inventory of code in that time. And if you've been following...
6
1525
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) strPageName = Value End Set
4
1214
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 really need to get this working. Any ideas? I have tried calling the functions directly from the parent page's page load event, but that doesn't work because the controls aren't rendered yet and I keep getting Object not set to reference errors....
2
6971
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 attending interviews. If you own a company best way to judge if the candidate is worth of it. http://www.questpond.com/InterviewRatingSheet.zip
0
3673
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 delegates were given CDs containing a pre-release version of the .NET framework/SDK and Visual Studio.NET. · When was the first version of .NET released? The final version of the 1.0 SDK and runtime was made publicly available around 6pm PST on...
0
3847
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 for the first time versus when the form is posted (sent to the server), which allows you to program accordingly. · What are user controls and custom controls? Custom controls: A control authored by a user or a third-party software vendor that...
0
9704
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10070
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7608
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6845
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5508
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5639
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4282
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2978
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.