473,385 Members | 1,732 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.

C# Function - how to use in both aspx page and ascx user control

Howdy
I've got a function that I want to be able to be used by both my .aspx page
and by my user control which is stored in a ascx file.
how do I do this?

Public function in a .cs file included in the .aspx page?
Will try it out now
Thanks
Matt
Nov 19 '05 #1
3 1561
The basic thing you can do is:

from user control ascx page.

Do that:

((YourAspxPagesClassName)this.Page).MethodYouAreTr yingToReach();

--

SevDer
http://www.sevder.com
A new .NET Source For .NET Developers
"Matt Jensen" <ne***********@microsoft.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Howdy
I've got a function that I want to be able to be used by both my .aspx
page and by my user control which is stored in a ascx file.
how do I do this?

Public function in a .cs file included in the .aspx page?
Will try it out now
Thanks
Matt

Nov 19 '05 #2
Make a seperate class with public static methods.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Howdy
I've got a function that I want to be able to be used by both my .aspx
page
and by my user control which is stored in a ascx file.
how do I do this?
Public function in a .cs file included in the .aspx page?
Will try it out now
Thanks
Matt


Nov 19 '05 #3
Thanks guys
will see how I go. Still learning exponentially...!
Cheers
Matt

"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:10***********************@msnews.microsoft.co m...
Make a seperate class with public static methods.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Howdy
I've got a function that I want to be able to be used by both my .aspx
page
and by my user control which is stored in a ascx file.
how do I do this?
Public function in a .cs file included in the .aspx page?
Will try it out now
Thanks
Matt


Nov 19 '05 #4

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

Similar topics

0
by: dh | last post by:
As a simple example, I can't seem to be able to reference a label called "lblOutput" that exists in my test.aspx page from within a User control, TestControl.ascx. I am stumped. Any help is...
2
by: Stephen | last post by:
I need some help with this. I have two files page.aspx: A page that a user calls uc.ascx: A user control that page.aspx uses. The ascx file has HTML used for a site background which would...
4
by: George Durzi | last post by:
I created a simple user control which contains a hyperlink to link the user to a topic in a compiled help file. I named all my help topics to have the same name as the aspx they are for. So in...
4
by: Nedu N | last post by:
Hi, I want to put a HTML table on aspx webform so that i can place my header, menu, footer user controls appropriately. I got 3 user controls header.ascx menu.ascx footer.ascx I trying to...
6
by: grist2mill | last post by:
I want to create a standard tool bar that appears on all pages that is a control. The toolbar has a button 'New'. What I wolud like when the user clicks on 'New' depends on the page they are on. I...
2
by: Ric | last post by:
im new to asp.net. from what i understand, you have the aspx file (presentation), user-control(ascx file), code-behind(vb file) and components(compiled vb and dll files). the aspx file contains a...
1
by: Will Gillen | last post by:
I know this has probably been asked before, but I can't seem to find a solid answer in any of the archives. First, before my question, please forgive my limited knowledge of the event lifecycle...
2
by: mharness | last post by:
Hello, I've tried a number of examples showing how to read the properties of a user control from an aspx file where the code is on the html view of the form but I can't figure out how to read...
3
by: Bert | last post by:
Hi How can you call a function on a user control(.ascx) ? what is the syntax for this? thanks Bert
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
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...
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,...

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.