Newbie question: Why don't forms act reasonably?

C

CedricCicada

Greetings!

I am trying to teach myself ASP.Net, using the Visual Studio .Net IDE.
So far, the hardest thing I've found is trying to edit controls on a
page. The editor does not seem to act as I have come to expect from
VB, C#, and FoxPro. For example, I can't drag a rectangle around
several controls and have all of them be selected. I can't use Ctrl-A
to select all controls and then right-click and select Run As Server
Control for all of them; as soon as I right-click, the control I'm on
becomes the only one selected. It is extremely hard to expand the size
of a form. The only way I've found is to select several controls and
drag them down. As the bottom of the select falls off the bottom of the
form, the form is expanded to compensate. There's got to be a better
way than that. Is there some setting I can use to get forms to behave?

Is there a better form for complete newbies at ASP.Net?

Thank you very much!

RobR
 
N

Nathan Sokalski

Well, there are two things that I think I need to point out to you here:

1. Keep in mind that you are creating something that will be used as an
application that generates web pages. ASP.NET generates web pages that use
HTML, Javascript, and CSS. Because these technologies do not use a
fixed-size page (the width/height depends on the size of the user's browser
window, the content of the page, and sometimes various CSS properties), each
Control is placed after the previous control (or tag such as a <BR> or
content such as &nbsp;). If you prefer (although it is not usually
recommended) you can work in GridLayout mode by doing one of the following:

1. Add the following attribute to the BODY tag: MS_POSITIONING="GridLayout"

OR

2. Select the DOCUMENT (by clicking somewhere other than a Control). In the
Properties list, set pageLayout to GridLayout (this will add the attribute
mentioned above).

Working in GridLayout mode basically allows you to use absolute positioning
using CSS properties by dragging the Controls around. But once again, I do
not recommend it for several reasons:

1. It increases the file size by adding extra CSS to every Control
2. It makes it harder to design pages that will look good on all screen
sizes (extra white space on larger monitors, extra scrolling on smaller
monitors)
3. It makes maintaining pages harder (if you change the size of a Control by
adding/removing text, changing height/width, or adding/removing a Control,
you must manually adjust the position of all controls after that Control)
4. Once you start creating custom user controls (it sounds hard, but it
isn't, and they are important to know how to use), you will be forced to use
FlowLayout because custom user controls do not support GridLayout
5. It is good to work in the same mindset as the browser when designing a
page, it makes it easier to know what to expect

I think the reason you are having trouble adjusting to Visual Studio .NET's
ASP.NET IDE is because it sounds like you have been using Visual Studio to
create applications for Windows. Windows generally uses a GridLayout-style
form (it might have a different name in Windows Forms). You need to realize
the difference in interfaces between Windows Applications and Web
Applications. Hopefully this helps, Good Luck!
 
O

Otis Mukinfus

Nathan,

Thanks very much for your reply. I am sure you are correct.

Rob
In addition to using the Grid layout mode when creating pages (I agree
with Nathan; not recommended) you can put the controls in a table that
arranges them IN RELATION to one another, but not always in the exact
spot on the page.

If you want to see an example of this, go to just about any web page
on the Internet and view the source. You will see many instances of
input controls, etc. placed between the tags <td> and </td> these two
tags are delimiters for cells in a table.

Here is an example showing a row <tr></tr> and a cell <td></td>
containing an ASP:TextBox control

<tr>
<td align="left" colspan="2"><ASP:TEXTBOX id="txtCall"
runat="server" width="216"></ASP:TEXTBOX></td>
</tr>

Good luck,

Otis Mukinfus
http://www.otismukinfus.com
http://www.tomchilders.com
 

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

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,054
Latest member
LucyCarper

Latest Threads

Top