how to make a buttton visible using a universal method
how to make a buttton visible using a universal method
how to make a buttton visible using a universal method
how to make a buttton visible using a universal method
how to make a buttton visible using a universal method
how to make a buttton visible using a universal method how to make a buttton visible using a universal method how to make a buttton visible using a universal method how to make a buttton visible using a universal method how to make a buttton visible using a universal method how to make a buttton visible using a universal method how to make a buttton visible using a universal method how to make a buttton visible using a universal method
how to make a buttton visible using a universal method how to make a buttton visible using a universal method
how to make a buttton visible using a universal method
Go Back  Xtreme Visual Basic Talk > > > how to make a buttton visible using a universal method


Reply
 
Thread Tools Display Modes
  #1  
Old 08-28-2006, 12:53 AM
sara23apr sara23apr is offline
Newcomer
 
Join Date: May 2006
Posts: 23
Default how to make a buttton visible using a universal method


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 ?

Thanks you
Sara
Reply With Quote
  #2  
Old 08-28-2006, 07:08 AM
wayneph's Avatar
waynephhow to make a buttton visible using a universal method wayneph is offline
Web Junkie

Retired Moderator
* Expert *
 
Join Date: Apr 2004
Location: D/FW, Texas, USA
Posts: 8,393
Default

you'll need to pass in a reference to your page.

This will toggle any control named btnAdd.
Code:
Public Sub myGlobalSub(pge as Page, display as Boolean) pge.FindControl("btnAdd").Visible = display End Sub

This is how you'd call it.
Code:
myGlobalSub(Me, True) 'Turns it on myGlobalSub(Me, False)'Turns it off
this is untested, but i'm pretty sure it's close...
__________________
-- wayne, MSSM Retired
> SELECT * FROM users WHERE clue > 0
0 rows returned
Reply With Quote
  #3  
Old 08-29-2006, 03:51 AM
sara23apr sara23apr is offline
Newcomer
 
Join Date: May 2006
Posts: 23
Default Thanks

Thanks for the reply

I tried ...but keep getting error ""Object reference not set to instance of object""

I am new to oops....so unable to solve it

Thanks
Sara
Reply With Quote
  #4  
Old 08-29-2006, 07:09 AM
wayneph's Avatar
waynephhow to make a buttton visible using a universal method wayneph is offline
Web Junkie

Retired Moderator
* Expert *
 
Join Date: Apr 2004
Location: D/FW, Texas, USA
Posts: 8,393
Default

You'll need to have it in a Class. (I was asleep still when I posted yesterday.)

I just tested it and made a class called PageUtils, and then made the function Shared so that I didn't need to make a instance of the class.

In app_code\PageUtils.vb
Code:
Public Class PageUtils Public Shared Sub myGlobalSub(ByVal pge As Page, ByVal display As Boolean) pge.FindControl("btnAdd").Visible = display End Sub End Class
Somewhere in a forms code behind. (I tested it in another button click.)
Code:
PageUtils.myGlobalSub(Me, False) PageUtils.myGlobalSub(Me, True)
__________________
-- wayne, MSSM Retired
> SELECT * FROM users WHERE clue > 0
0 rows returned
Reply With Quote
  #5  
Old 09-07-2006, 10:51 AM
sara23apr sara23apr is offline
Newcomer
 
Join Date: May 2006
Posts: 23
Default Thanks for the help

I have planned to implement this in my next project. By then i will study and update my OOPS skills. For the current project i am using page level procedures.

Thanks for your time
Sara
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
how to make a buttton visible using a universal method
how to make a buttton visible using a universal method
how to make a buttton visible using a universal method how to make a buttton visible using a universal method
how to make a buttton visible using a universal method
how to make a buttton visible using a universal method
how to make a buttton visible using a universal method how to make a buttton visible using a universal method how to make a buttton visible using a universal method how to make a buttton visible using a universal method how to make a buttton visible using a universal method how to make a buttton visible using a universal method how to make a buttton visible using a universal method
how to make a buttton visible using a universal method
how to make a buttton visible using a universal method
 
how to make a buttton visible using a universal method
how to make a buttton visible using a universal method
 
-->