create webcontrols in aspx or aspx.cs

B

brown

Is it best to always put the webcontrols in the aspx file or is it sometimes
better to create them (new) in the code behind? I see the standard/easiest
way is to place them in the aspx, but are there common situations where your
output is conditional and it's better to just do it in the aspx.cs file?
 
B

Brennan Stehling

When you want to have a control shown or hidden depending on a certain
context you can set the Visible property of your controls.

Normally what I do is wrap multiple controls within a Panel or
PlaceHolder control and set the Visible property as needed. You may
also want to look at the MultiView and Wizard controls. Those provide
automatic show/hide functionality with added features.

Brennan Stehling
http://brennan.offwhite.net/blog/
 
B

brown

Thanks for your feedback!
Do you use the Table webcontrol or just put the webcontrols inside
unscripted <table><tr><td> tags in the aspx file?
I'm thinking try the latter. Just interested in what experienced .net
developers approach is to formatting the webcontrols on the page.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top