Custom Web Control and GridLayout

J

jef

I'm somewhat new to ASP.NET but have a lot of VB6 experience. I
thought I'd dive into custom web controls as a way to encapsulate some
common functionality. Once I drag the control onto my web form, it's
stuck in the upper-left corner. I also thought I might try to use a
panel control as a container for a bunch of related controls that I
wanted to make visible/hidden on the fly. That was a disaster as well
since I couldn't easily control the layout.
Ultimately, my dilema lies in the fact that I'm approaching this with
my VB6 brain. I want to have complete control over the exact layout of
my web form. And for the project I'm working on, that's not a
unrealistic expectation since we are forcing the browser window to
800x600 and won't be moving the controls around if the window resizes.
So... here's my question. Should I just stick with the simple webform
and layout all of my controls there? It seems that once I try to
introduce a custom web control it gets really messy if I want to have
fixed positioning of the custom control and all other controls on the
form.

Any input is welcome... I'm still trying to wrap my brain around this
new (for me) way of building user interfaces.

-jef
 
H

HoustonFreeways

Any input is welcome... I'm still trying to wrap my brain around this
new (for me) way of building user interfaces.

-jef

I build a lot of user interfaces in VB.Net, and my view on this subject is
that you want to use simple webforms whenever possible and then incorporate
more sophisticated techniques as the situation warrants or as pages become
large and complex.

In general, making controls (such as a custom control) involves a certain
amount of overhead (such as exposing all the properties) and the amount of
effort involved can escalate substantially when you need to make the control
very general. On the other hand, good object-oriented programming avoids
code duplication so this suggests use of controls.

I usually stick to user controls (.ascx) for simple controls that are mainly
GUI-oriented. Your positioning issue should not be a problem in a user
control, since it is just like a web form.

If there are multiple controls that lend themselves to inheritance and
sharing of methods, then I use composite controls. Composite controls
require the createChildControls method and are best done with the render
method.
 

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,888
Messages
2,569,965
Members
46,294
Latest member
HollieYork

Latest Threads

Top