|
-
Aug 29th, 2006, 05:00 AM
#1
Thread Starter
Lively Member
how to reference a control in a procedure (class)
I have a web site with 20 web pages ,
1) Each page has one has a Standard button bar with 5 buttons ( ADD, EDIT, DELETE, VIEW , EXIT), buttons will be visible or invisible depending on the operations being done.
The above operation is universal for all the pages.
How do i write a class with methods to make the above operation universal? I want to put this class in app_code directory .
I Tried to put classes in app_code. but unable to hide show buttons of the individual page.I get a message "Object reference not set to instance of object". My team is now learning the fundamentals oops. so we do not know how to proceed!!!
So my question is
1) how do i make the universal method recognize the button of an invidual page (which called the method) and make it Visible/invisible ?
One of my friend asked me to try.....
Public Sub myGlobalSub(pge As Page, display As Boolean)
pge.FindControl("btnAdd").Visible = display
End Sub
--------------------------------------------------------------------------------
and by calling it
VB:
--------------------------------------------------------------------------------
myGlobalSub(Me, True) 'Turns it on
myGlobalSub(Me, False)'Turns it off
--------------------------------------------------------------------------------
But I still get error ...Object reference not set to instance of object
Please help me -- Thank you
Sara
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|