 |
| ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

May 27th, 2004, 09:21 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
'Member Links' Control
I'm trying to code a control that shows up if a 'member' signs in.
------------
Member Links
------------
change profile
log out
etc
What is the best way to accomplish this? I was thinking of making it hiden and if the user is logged in make it visible. Any suggestions?
|
|

May 27th, 2004, 09:42 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi stu9820,
Yeah, that's how I usually do it. I have a User Control with two placeholders (or other container controls). One placeholder holds the stuff you see when you're not logged in (a Login link, a Signup link etc etc) and the other has the Logout, Profile links etc.
The Code Behind for the control checks the logged in status of the user, and hides and displays the appropriate container. This way, your application doesn't need to worry about all this; all you need to do is drop a control on your page.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

May 27th, 2004, 10:14 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
I was thinking of using panels. Is there any performance difference between placeholders and panels?
|
|

May 27th, 2004, 10:36 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
A placeholder is strictly a server side control. It's basically nothing more than an empty control with a collection of controls. The panel on the other hand, generates some HTML. In some browsers it generates a <div>, in others it generates a <table>.
|
|

May 27th, 2004, 10:45 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Yes, Peter is correct. That's why I prefer PlaceHolders in this kind of scenarios as they generate no output when the control is visible.
The placeholder is really just that; a container control to conveniently hide or display other, nested, controls.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

May 27th, 2004, 10:52 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
One thing I have noticed however, is that when you use an asp:placeholder in the HTML markup sometimes the controls inside act funny in the HTML editor. You get designtime errors that "this control can't be in a placeholder", or the intellisense doesn't completely work. It's odd. But it works when it runs.
|
|

May 27th, 2004, 11:49 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Thanks guys.
|
|
 |