PC Review


Reply
Thread Tools Rate Thread

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

 
 
theintrepidfox@hotmail.com
Guest
Posts: n/a
 
      24th Mar 2006

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.SetText()
....

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

 
Reply With Quote
 
 
 
 
Erik Funkenbusch
Guest
Posts: n/a
 
      25th Mar 2006
On 24 Mar 2006 15:45:28 -0800, (E-Mail Removed) 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?
 
Reply With Quote
 
theintrepidfox@hotmail.com
Guest
Posts: n/a
 
      25th Mar 2006
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.GetMnuLanguage(mnuLanguage)

In class:

Public Function GetMnuLanguage(ByVal objmnuLanguage As Menu) As Menu

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

Return mnuLanguage

End Function

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
when i reference a com object by regsvr32 it then find it in the COM tab, it works ok. but when i reference a com object by referencing the .dll file i get this error in my C# application: DR Microsoft Dot NET 1 19th Jan 2008 05:01 PM
when i reference a com object by regsvr32 it then find it in the COM tab, it works ok. but when i reference a com object by referencing the .dll file i get this error in my C# application: DR Microsoft C# .NET 1 18th Jan 2008 08:18 AM
when i reference a com object by regsvr32 it then find it in the COM tab, it works ok. but when i reference a com object by referencing the .dll file i get this error in my C# application: DR Microsoft Dot NET Framework 0 18th Jan 2008 03:22 AM
Coming out of the closet: I love Vista! ceed Windows Vista General Discussion 43 5th Oct 2007 02:00 AM
Create an object on the fly knowing just an object type Just D. Microsoft ASP .NET 2 7th May 2005 04:06 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:40 PM.