Postioning th controls on the Web form......

S

San Ramon

I am developing ASP.Net application using VB
using VS.2003. I have more than 100 ASP server controls on the form. It is
taking lot of time to position them on the screen. Is there any easy way to
do that ? I am using grid layout.
Please advice.
San
 
C

Cowboy \(Gregory A. Beamer\) [MVP]

I would recommend moving away from grid control, as it has to place each of
the controls based on X and Y coordinates. They will paint in the order they
were placed on the form, unless you alter the order by setting them.

I find it much better to create tables and place items in tables, much like
FrontPage or Dreamweaver, rather than using the grid. In addition to more
easily painting the page, you will also find the size diminishes by getting
rid of all of the X, Y and Z coords.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************************************************
Think outside the box!
***************************************************************
 
S

Scott M.

I STRONGLY agree that tables are the way to go. First step is to determine
the target screen resolution of your audience. Since 800 x 600 is currently
the most common resolution (for home users), you would back 30 to 40 pixels
off the horizontal (to leave room for the browser's border and scroll bar),
which would leave say 760 pixels to work with.

Now create a table that has the desired row/column configuration but is not
wider than 760 pixels. Remember to count the table border if using one, the
cellpadding of EACH cell and the cellspacing between EACH cell or you'll
actually go over your target maximum width (760).

Place your controls in the correct cells of the table using standard HTML
paragraphs and line breaks.

When you are done, you'll have all the controls held securely in place in a
table that will look the same to anyone, regardless of their particular
screen resolution.
 
S

San Ramon

Can you please show me an example with two controls(one is label and one
more is edit box) in it.
I appreciate your suggestion.
San
 
S

Scott M.

Tables come in all different shapes and sizes. Here is a simple 3 row by 2
column table that is 760 pixels wide with a label in row 1, column 1 and a
textbox in row 1, column 2.

I should also tell you that this is pretty basic HTML stuff (knowing to use
tables to layout the page). You may want to brush up on HTML techniques
before going to far into asp.net.

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb"
Inherits="WebApplication1.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
<meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body >

<form id="Form1" method="post" runat="server">
<TABLE ID="Table1" CELLSPACING="1" CELLPADDING="1" WIDTH="760" BORDER="0">
<TR>
<TD><asp:Label id="Label1" runat="server">Label</asp:Label></TD>
<TD><asp:TextBox id="TextBox1" runat="server"></asp:TextBox></TD></TR>
<TR>
<TD></TD>
<TD></TD></TR>
<TR>
<TD></TD>
<TD></TD></TR></TABLE>

</form>

</body>
</HTML>
 
S

San Ramon

Thank you very much

Scott M. said:
Tables come in all different shapes and sizes. Here is a simple 3 row by 2
column table that is 760 pixels wide with a label in row 1, column 1 and a
textbox in row 1, column 2.

I should also tell you that this is pretty basic HTML stuff (knowing to use
tables to layout the page). You may want to brush up on HTML techniques
before going to far into asp.net.

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb"
Inherits="WebApplication1.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
<meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body >

<form id="Form1" method="post" runat="server">
<TABLE ID="Table1" CELLSPACING="1" CELLPADDING="1" WIDTH="760" BORDER="0">
<TR>
<TD><asp:Label id="Label1" runat="server">Label</asp:Label></TD>
<TD><asp:TextBox id="TextBox1" runat="server"></asp:TextBox></TD></TR>
<TR>
<TD></TD>
<TD></TD></TR>
<TR>
<TD></TD>
<TD></TD></TR></TABLE>

</form>

</body>
</HTML>
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top