473,657 Members | 2,851 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Coming out of the closet - Object Reference - Knowing I most likely won't get an answer...


Hi Everyone

Here's a really simple and fundamental question for you boys and girls.
I'm quite embarrased asking it actually as I've ben programming for
four years now, always working my way around the issue, but thought of
finally coming out of the closet.

Question:
How do I manipulate (reference) an object on a form (.aspx) in ASP.NET
2.0 from a class? There are articles on how pass values between forms
etc etc but I really never figured that out which is really bad I
guess!

Sample:
I've a page called default.aspx with a ASP.NET 2.0 label control
And I've a class in the App_Code folder called clsLabel.vb

In the code-beside of default.aspx I'd like to put something like:
....
Label1.text = clsLabel.SetTex t()
....

While I've a Sub in clsLabel that sets the label text.
....
Label1.text = "Hello"
....

Note that this is a simple example and
I'd be grateful if you can please explain in plain English and
idiot-proof way.
Thank you for your help, infinite wisdom and efforts!

Martin

Mar 24 '06 #1
2 1078
On 24 Mar 2006 15:45:28 -0800, th************@ hotmail.com wrote:
Question:
How do I manipulate (reference) an object on a form (.aspx) in ASP.NET
2.0 from a class? There are articles on how pass values between forms
etc etc but I really never figured that out which is really bad I
guess!


I think your premise is flawed. You shouldn't be trying to manipulate a
form from a middle tier class. That's the entire point of middle tier, to
seperate logic from presentation.

A form should call into your object to get it's data. The data should not
call into the form. Get the picture?
Mar 25 '06 #2
Thanks for your advice and thoughts Erik

Yes, that makes sense and admit that I actually have explained it
incorrectly.
The form calls indeed the class not the other way round. My intention
has been lost in simplifiying the issue.
What I really trying to do is have my form call a function in my class
and then return an object.
It's working know. Hope it's good practice the way I do it though?
Thank you very much for your time and efforts and for pointing me in
the right direction!

In aspx:

Dim clsFraMenu As New clsFraMenu
mnuLanguage = clsFraMenu.GetM nuLanguage(mnuL anguage)

In class:

Public Function GetMnuLanguage( ByVal objmnuLanguage As Menu) As Menu

Dim mnuLanguage As Menu = objmnuLanguage
....
Add menu items
....

Return mnuLanguage

End Function

Mar 25 '06 #3

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

Similar topics

28
20301
by: Daniel | last post by:
Hello =) I have an object which contains a method that should execute every x ms. I can use setInterval inside the object construct like this - self.setInterval('ObjectName.methodName()', this.pinginterval); - but is there no way to do this without using the literal ObjectName? If I write 'this.methodName()' I get "Line 1 Char 1: Object doesn't support this property or method." in IE, and nothing happens in Firebird.
11
9241
by: DrUg13 | last post by:
In java, this seems so easy. You need a new object Object test = new Object() gives me exactly what I want. could someone please help me understand the different ways to do the same thing in C++. I find my self sometimes, trying Object app = Object(); Object *app = Object(); Object app = new Object();
30
3721
by: jimjim | last post by:
Hello, This is a simple question for you all, I guess . int main(){ double *g= new double; *g = 9; delete g; cout<< sizeof(g)<<" "<<sizeof(double)<<" "<<sizeof(*g)<<" "<<*g<<" "<<endl; *g = 111; cout<< sizeof(g)<<" "<<sizeof(double)<<" "<<sizeof(*g)<<" "<<*g<<" "<<endl;
8
1244
by: Lee Jackson | last post by:
Whats the difference between the following in terms of how the CLR allocates and garbage collects? Which is better in terms of memory usage/performance? a) foreach (string strURL in arrLongListOfURLs) { string strCopy = strURL; }
8
1846
by: Lance | last post by:
I've been teaching myself C# for a few months now and I have a concept problem. I know how to instantiate an object from a class I’ve created, but now I want to retrieve and store data in a database and I can’t seem to understand how I would name my objects. For example, I have an employee’s database with all the info I want an employee to have. I also have an employee class, that with methods can open and retrieve an employee from the...
5
2513
by: Michael Moreno | last post by:
Hello, In a class I have this code: public object Obj; If Obj is a COM object I would like to call in the Dispose() method the following code: System.Runtime.InteropServices.Marshal.ReleaseComObject(Obj);
12
5538
by: Andrew Poulos | last post by:
With the following code I can't understand why this.num keeps incrementing each time I create a new instance of Foo. For each instance I'm expecting this.num to alert as 1 but keeps incrementing. Foo = function(type) { this.num = 0; this.type = type this.trigger(); } Foo.prototype.trigger = function() {
22
4177
by: Cylix | last post by:
I have a 4row x 1col table, I would like to drop all the content of row three. Since Mac IE5.2 does not suppport deleteRow method, I have also try to set the innerHTML=''; but it does not work. How can I delete the node from DOM in other way? Thanks.
20
13311
by: Justin Rich | last post by:
so im trying to be good and not leave anything hanging open but i guess ive seen a variety of ways to kill objects.. is there like a recommended way? basically im looking for best practices for handling object destruction. Thanks Justin
0
8385
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
8723
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8502
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8602
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
6162
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
4150
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
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
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
1601
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.