Link to home
Start Free TrialLog in
Avatar of abennett10
abennett10

asked on

ASP.net (vb.net) Sub routine that can be used throughout the application

Hello Guru's!

How can I create a subroutine in asp.net\vb.net that I can use throughout my application?

For example,

I want to create a usercontrol that I can use as a standard tool bar on all of my pages that let's you know who is logged in and give the logoff button option.

How would I do this?

Thanks in advance!
Avatar of nayernaguib
nayernaguib
Flag of Egypt image

Assuming that you already have created the control, you have to do the following:

1. In the Page_Load method of each page, create a new instance of the control, and then add the control to the page.
2. You can store user information in session variables, so that any page throughout the application can access the information and use it to display data on the control.

_______________

  Nayer Naguib
The user control should be created as an ascx file (a "user control" file). You can then drag the user control onto any (or all) of your pages (assuming you're using Visual Studio). This will register the control in the HTML portion of your page, and instantiate the control.

BTW: generally, you should post to the ASP .Net topic area for ASP .net questions.... :)
Avatar of Bob Learned
Avatar of abennett10
abennett10

ASKER

Sorry about that, I'll make sure I post this in the asp.net section of the forum.

What code do I use to create a new instance of the control, and make sure that it is sized how I needed?
ASKER CERTIFIED SOLUTION
Avatar of Jeff Certain
Jeff Certain
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I will give that a try!

Thank you