473,472 Members | 2,039 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

call aspx function/sub/property from ascx event

I have a user control inside an aspx page. I was able to
create a Public property inside the ascx file and call it
from the aspx but whatever I do, I can't find the way to
cause an event from inside the ascx file to call any
function/sub/property etc. The error I'm getting
is "Reference to a non-shared member required an object
reference".
Nov 18 '05 #1
2 7131
I added to the ascx file the following line:
Protected WithEvents cls1 As cls1
where cls1 is the class name of the aspx page and in the
ascx Page_Init i wrote:
cls1 = MyBase.Page

It works fine but - is it the correct way?

Thanks

-----Original Message-----
I have a user control inside an aspx page. I was able to
create a Public property inside the ascx file and call it
from the aspx but whatever I do, I can't find the way to
cause an event from inside the ascx file to call any
function/sub/property etc. The error I'm getting
is "Reference to a non-shared member required an object
reference".
.

Nov 18 '05 #2
Check out: http://www.openmymind.net/communication/index.html

it takes about communication between a page and a user control including how
to do it via events.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"comp" <ni******@inter.net.il> wrote in message
news:95****************************@phx.gbl...
I added to the ascx file the following line:
Protected WithEvents cls1 As cls1
where cls1 is the class name of the aspx page and in the
ascx Page_Init i wrote:
cls1 = MyBase.Page

It works fine but - is it the correct way?

Thanks

-----Original Message-----
I have a user control inside an aspx page. I was able to
create a Public property inside the ascx file and call it
from the aspx but whatever I do, I can't find the way to
cause an event from inside the ascx file to call any
function/sub/property etc. The error I'm getting
is "Reference to a non-shared member required an object
reference".
.

Nov 18 '05 #3

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

Similar topics

27
by: Jason Shohet | last post by:
I have an ascx control, and it needs a value called 'orgID' which the parent page will have. I want to avoid the parent page setting values in fields on the ascx control since this violates...
1
by: moondaddy | last post by:
I need to replace a user control on a page with a different user control. The challenge I'm faced with is that this call is being made from the user control being replaced. Normally I replace...
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...
4
by: Zuel | last post by:
Hi Folks. So I have a small problem. My DoPostBack function is not writen to the HTML page nor are the asp:buttons calling the DoPostBack. My Goal is to create a totaly dynamic web page where...
5
by: Chad | last post by:
Alright, I've been searching all over and it seems I'm just not looking for the right thing, since what I want to do seems extremely simple I just don't know the correct syntax. All I get is how to...
3
by: Patrick.O.Ige | last post by:
I created a USERCONTROL and i want to call a LABEL from an ASPX page. The USERCONTROL is in the ASPX page I have the label :- Label lblstr = new Label(); And displaying using:-...
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...
1
by: RSH | last post by:
Hi, I have a situation where I have a user Control (ResultHeader.ascx) that has a button. I am placing that control into a page (samplePage.aspx). I have setup a custom event, that should from...
8
by: gnewsgroup | last post by:
I know that we can re-use/share code by placing the code in App_Code. But, is it possible for MyPage.aspx.cs to call a method defined in AnotherPage.aspx.cs? Suppose, in AnotherPage.aspx.cs,...
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...
1
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
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...
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,...
0
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...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.