473,796 Members | 2,625 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help- Aligning controls in .aspx page

Raj
Hi,

I have a ASP.NET project which is working fine and I need to align
controls in a .aspx page. The webform( .aspx page) has variety of
controls (labels, textboxes, radio buttons etc) and when a user resizes
the window, I would like these controls to center align in the page. Is
there a way to do this using visual studio? I did some research and
found a way using <table> <tr> <td> tags. But this is becoming
cumbersome for me because each row doesn't have the same number of
columns and relative positions of the controls on the page are lost.
Then I tried creating a table for each row. I have a feeling there
might be a better way to do all this using visual studio itself. Can
any one please point me in the right direction? Thank you!!

-Raj

Nov 29 '05 #1
5 12580
Raj,

I'm not too sure how your HTML currently looks. Are you just using the
designer drag and drop in grid mode that uses absolute positioning or are
you basically putting controls down the page and using <br> and <p> tags.

If you're not using absolute positioning, try just placing all your controls
in one table cell with align center.

An example:

<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="center">
Place all your controls and HTML as you already have it
</td>
</tr>
</table>

--
Jay Douglas
http://www.jaydouglas.com
"Raj" <an************ @yahoo.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
Hi,

I have a ASP.NET project which is working fine and I need to align
controls in a .aspx page. The webform( .aspx page) has variety of
controls (labels, textboxes, radio buttons etc) and when a user resizes
the window, I would like these controls to center align in the page. Is
there a way to do this using visual studio? I did some research and
found a way using <table> <tr> <td> tags. But this is becoming
cumbersome for me because each row doesn't have the same number of
columns and relative positions of the controls on the page are lost.
Then I tried creating a table for each row. I have a feeling there
might be a better way to do all this using visual studio itself. Can
any one please point me in the right direction? Thank you!!

-Raj

Nov 29 '05 #2
DJ
How about using <div>?

Not knowing exactly what you have and seeing it, perhaps the following might
be more useful.

<div align="center">
<asp:textBox id="whatever" runat="server"/>
</div>

You can assign each div a class and position it as required. I use divs
exclusively for layout, and use tables only for data presentation (ie,
rosters, etc.).

Another thought would be to create styles in CSS and use the CssClass
attribute of the control to put it where you want it.

Jim Hawley

"Raj" wrote:
Hi,

I have a ASP.NET project which is working fine and I need to align
controls in a .aspx page. The webform( .aspx page) has variety of
controls (labels, textboxes, radio buttons etc) and when a user resizes
the window, I would like these controls to center align in the page. Is
there a way to do this using visual studio? I did some research and
found a way using <table> <tr> <td> tags. But this is becoming
cumbersome for me because each row doesn't have the same number of
columns and relative positions of the controls on the page are lost.
Then I tried creating a table for each row. I have a feeling there
might be a better way to do all this using visual studio itself. Can
any one please point me in the right direction? Thank you!!

-Raj

Nov 29 '05 #3
Raj
Thank you Jay and Jim for your prompt responses. I am new to ASP.NET as
well as web programming. I am using designer drag and drop of visual
studio. The html part of it looks like this:
<%@ Page Language="vb" AutoEventWireup ="false"
Codebehind="For got.aspx.vb" Inherits="OOLSi gnon.Forgot"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Forgot </title>
<meta content="Micros oft Visual Studio.NET 7.0" name="GENERATOR ">
<meta content="Visual Basic 7.0" name="CODE_LANG UAGE">
<meta content="JavaSc ript" name="vs_defaul tClientScript">
<meta content="http://schemas.microso ft.com/intellisense/ie5"
name="vs_target Schema">
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<asp:label id="lblTitle" style="Z-INDEX: 101; LEFT: 305px;
POSITION: absolute; TOP: 33px" runat="server" ForeColor="Navy "
Font-Bold="True" Font-Size="Large">We lcome to the UserID/Password
Retrieval System</asp:label>
<asp:label id="lblSSN" style="Z-INDEX: 102; LEFT: 410px; POSITION:
absolute; TOP: 96px" runat="server"> SSN</asp:label>
<asp:textbox id="txtSSN" style="Z-INDEX: 103; LEFT: 462px;
POSITION: absolute; TOP: 94px" runat="server"> </asp:textbox>
<asp:button id="btnLookup" style="Z-INDEX: 104; LEFT: 651px;
POSITION: absolute; TOP: 92px" tabIndex="5" runat="server" Width="95px"
Text="Find Me" Height="25px" EnableViewState ="False"
CausesValidatio n="False"></asp:button>
<asp:label id="lblSSNMsg" style="Z-INDEX: 108; LEFT: 413px;
POSITION: absolute; TOP: 125px" runat="server" ForeColor="Red"
Width="375px" Visible="False" >Error</asp:label>
<asp:label id="lblSecQuest ionLbl" style="Z-INDEX: 109; LEFT: 411px;
POSITION: absolute; TOP: 156px" runat="server" Visible="False" >Security
Question:</asp:label>
<asp:label id="lblSecurity Question" style="Z-INDEX: 105; LEFT:
529px; POSITION: absolute; TOP: 155px" runat="server"
Visible="False" >Security Question</asp:label>
<asp:label id="lblAnswer" style="Z-INDEX: 110; LEFT: 413px;
POSITION: absolute; TOP: 184px" runat="server"
Visible="False" >Answer:</asp:label>
<asp:textbox id="txtSecAnswe r" style="Z-INDEX: 106; LEFT: 529px;
POSITION: absolute; TOP: 185px" runat="server"
Visible="False" ></asp:textbox>
<asp:radiobutto nlist id="rblUserIDPa sswd" style="Z-INDEX: 114;
LEFT: 412px; POSITION: absolute; TOP: 225px" runat="server"
Visible="False" AutoPostBack="T rue">
<asp:ListItem Value="0">Forgo t User ID</asp:ListItem>
<asp:ListItem Value="1">Forgo t Password</asp:ListItem>
</asp:radiobutton list>
<asp:label id="lblUserID" style="Z-INDEX: 113; LEFT: 413px;
POSITION: absolute; TOP: 294px" runat="server" Visible="False" >User
ID:</asp:label>
<asp:textbox id="txtUserID" style="Z-INDEX: 107; LEFT: 529px;
POSITION: absolute; TOP: 292px" runat="server"
Visible="False" ></asp:textbox>
<asp:button id="btnEMail" style="Z-INDEX: 112; LEFT: 506px;
POSITION: absolute; TOP: 356px" tabIndex="5" runat="server"
Width="95px" Height="25px" Visible="False" Text="EMail
Me"></asp:button>
<asp:label id="lblInfo" style="Z-INDEX: 111; LEFT: 412px; POSITION:
absolute; TOP: 401px" runat="server" ForeColor="Red"
Visible="False" >Info</asp:label>
<asp:hyperlin k id="hlHome" style="Z-INDEX: 115; LEFT: 524px;
POSITION: absolute; TOP: 470px" runat="server"
NavigateUrl="OO LSignon.aspx">H ome</asp:hyperlink>
</form>
</body>
</HTML>

How can I change this so that the controls retain their relative
positions with respect to each other and at the same time reposition
themselves when a window is made small/large. Looks like we can't do
this in visual studio. Is that right?
Thank you for your help.
-Raj

Nov 29 '05 #4
If you are using the designer drag and drop then you will be absolutely
positioning your controls. To get a more flow layout you need to use
either a table layout or a css layout. As a beginner, I would go for a
table based page layout. Do a google search for HTML Table based page
layout.

Nov 29 '05 #5
Raj
That worked!! Thank you!!

Dec 1 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3848
by: tesc | last post by:
I'm sure this is pretty simple but I'm having a hard time with it. I have a report that has multiple columns and have to change some of the titles in the page header. As a result, the titles don't match up with the detail. I've used the all the formatting buttons such as align, size, etc. but it doesn't seem to work that well. I've also tried highlighting the page header and detail at the same time and formatting at the same time -...
4
12872
by: William LaMartin | last post by:
Is there a way to place an aspx page on a panel contained on another aspx page? I can display an HTML page on the panel using a literal can figure no way to put and aspx page there.
0
979
by: msnews.microsoft.com | last post by:
Hello Every Body, I need the help. I have the scenario that i want to generate mail at runtime from aspx page. For that purpose how can i execute aspx page from and other page and returns its HTML as MSXMLHTTP COM component. How can i perform MSXMLHTTP COM componenet functionality in asp.net without using it. Thanks
1
2168
by: Mark | last post by:
Hopefully somebody can help me with this very frustrating problem. In Dreamweaver I have a template page and a page created from this template called Home.aspx. In Visual Studio I have a class inherited from System.Web.UI.Page which represents the template (including all components and associated events defined in the template). Then I have a codebehind file for Home.aspx that defines a class (Home) that includes controls specific to...
2
1636
by: kermit | last post by:
I have a .net aspx page MyPage.aspx (client side) with code behind MyPage.aspx.vb (server side). I use the Page_Load event in MyPage.aspx.vb to load data into a multiteir class based collection. MyCollection(sYear).cMonths(sMonth).cDays(sDay).cEvents(sID).EventText My problem arrives when I try to access this collection from the page (MyPage.aspx).
2
1664
by: Progman | last post by:
How can I load an aspx page from vb script procedure in a main aspx page. I want to avoid server.execute. I want that main page to be replaced by the new page. I dont want to use a button to call the page.
1
1396
by: intrader | last post by:
I have the trouble debugging at the server with Visual Studio 2003. I have the development environment running and I choose Tools/Debug Processes and I attach to apsnet_wp.exe, click on Break - it tells me 'Unable to break in the process apsnet_wp.exe. The process does not contain any programs'. When I set a breakpoint in the aspx.cs file (the code behind), it does not stop there. Please help!
3
1268
by: gbjornholm | last post by:
I am trying to loop through all the controls on my webform to get it's ID property. My eventual goal is going to be to reset the text of specific contols. Here is a piece of the code I am using, that I found searching through Google: Dim control As Control For Each control In Me.Page.Controls
2
1999
crabpot8
by: crabpot8 | last post by:
I am working on a message system that will let out programmers easily output a message to any user. It works fine, unless the message is requested inside of a page_load on an aspx page. Then, it does not render at all. The code does step through, and the control is added - I believe it might be being added to late in the page lifecycle to get rendered. I can't seem to find any way to tell .NET to render that control, however. ...
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9531
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10018
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9055
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7553
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6795
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5446
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5578
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3735
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.