Wrox Programmer Forums
|
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
 
Old May 27th, 2004, 09:21 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default '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?



 
Old May 27th, 2004, 09:42 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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.
 
Old May 27th, 2004, 10:14 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

I was thinking of using panels. Is there any performance difference between placeholders and panels?

 
Old May 27th, 2004, 10:36 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

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>.
 
Old May 27th, 2004, 10:45 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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.
 
Old May 27th, 2004, 10:52 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

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.
 
Old May 27th, 2004, 11:49 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Thanks guys.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Hi.. new member here.. renai C# 1 August 26th, 2007 11:20 AM
Disable side bar links of Wizard Control everest ASP.NET 2.0 Professional 0 February 14th, 2007 01:33 AM
Hello from a new member aehb C# 0 March 10th, 2005 05:51 PM
I'm a new member.. kiddyboy Visual C++ 1 August 12th, 2003 07:21 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.