473,462 Members | 1,128 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to position a user control on a web form

I'm trying to create my first user control and its function is to replace
the use of a frames page. I want to position it under the pages header
menus and to the right of the pages contents menus. How can I set the top
and left position of this control?

--
mo*******@nospam.com
Nov 18 '05 #1
3 6419
Perhaps there is a more sophisticated way, but you can always position the
user control by placing it (declaratively) within a table cell (<TD>).

"moondaddy" <mo*******@nospam.com> wrote in message
news:eo**************@TK2MSFTNGP11.phx.gbl...
I'm trying to create my first user control and its function is to replace
the use of a frames page. I want to position it under the pages header
menus and to the right of the pages contents menus. How can I set the top
and left position of this control?

--
mo*******@nospam.com

Nov 18 '05 #2
Hi moondaddy,
Thank you for using MSDN Newsgroup! My name is Steven, and I'll be
assisting you on this issue.
From your description, you add a UserControl onto a webpage, and you'd like
to manually control the position of the UserControl to some certain place
on the page?
If there is anything I misunderstood, please feel free to let me know.

Based on my experience, I think there're several means to help implement
the controls' position on a web page.
1. Using the table to control the page layout and structure. I always think
this the most wonderfully way when dealing with the page's layout. Since
the table can be embed each other and for many hierarchy. You can put a
large table in a page to perform the main layout and then in the large
table's cells, put some small table to perform the detailed layout
operations. As for the problem in our issue, you may try putting the
UserControl in a certain table cell to position it. Also. one of the
advantages of using table to perform layout is the table can adjust itself
in with of height when the page is resized.(table can derived the width and
height from its parent/container control).

2. If you do think it better to use absolute position mode to specify the
UserControl's position, I think you may try use a "<div>" tag. The div
elment can set its "style" attribute to specify its absolute position on a
page. For example:
<div style="LEFT: 300px; WIDTH: 200px; POSITION: absolute; TOP: 300px;
HEIGHT: 200px">
Hello, I am a Div!
</div>

This is a simple div, we set its absolute position as (300,300) on the
page.Then , you can put your UserControl in the div so as to position it.
And also we can specify the "height" and "width" attribute. There are still
many other good features of the "<div>" element, for detailed information,
you can view the following reference in MSDN:
http://msdn.microsoft.com/library/de...thor/dhtml/ref
erence/objects/div.asp
Please check out the preceding suggestions. If you have any questions or
need any further help, please feel free to let me know.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #3
In addition to Steven's remarks concerning absolute positioning, if you use
CSS, you can control not only the position of your elements in divs, but the
entire appearance of them. See http://csszengarden.com for examples of what
I'm talking about.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Steven Cheng[MSFT]" <v-******@online.microsoft.com> wrote in message
news:yS**************@cpmsftngxa07.phx.gbl...
Hi moondaddy,
Thank you for using MSDN Newsgroup! My name is Steven, and I'll be
assisting you on this issue.
From your description, you add a UserControl onto a webpage, and you'd like to manually control the position of the UserControl to some certain place
on the page?
If there is anything I misunderstood, please feel free to let me know.

Based on my experience, I think there're several means to help implement
the controls' position on a web page.
1. Using the table to control the page layout and structure. I always think this the most wonderfully way when dealing with the page's layout. Since
the table can be embed each other and for many hierarchy. You can put a
large table in a page to perform the main layout and then in the large
table's cells, put some small table to perform the detailed layout
operations. As for the problem in our issue, you may try putting the
UserControl in a certain table cell to position it. Also. one of the
advantages of using table to perform layout is the table can adjust itself
in with of height when the page is resized.(table can derived the width and height from its parent/container control).

2. If you do think it better to use absolute position mode to specify the
UserControl's position, I think you may try use a "<div>" tag. The div
elment can set its "style" attribute to specify its absolute position on a
page. For example:
<div style="LEFT: 300px; WIDTH: 200px; POSITION: absolute; TOP: 300px;
HEIGHT: 200px">
Hello, I am a Div!
</div>

This is a simple div, we set its absolute position as (300,300) on the
page.Then , you can put your UserControl in the div so as to position it.
And also we can specify the "height" and "width" attribute. There are still many other good features of the "<div>" element, for detailed information,
you can view the following reference in MSDN:
http://msdn.microsoft.com/library/de...thor/dhtml/ref erence/objects/div.asp
Please check out the preceding suggestions. If you have any questions or
need any further help, please feel free to let me know.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #4

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

Similar topics

0
by: MLH | last post by:
If I have a form with a textbox control on it bound to a memo field, can I somehow determine the position of cursor in that control if user has entered the control in edit mode? IE, the user has...
1
by: cindy | last post by:
I have a web form I checked body tag it is <body ms_positioning="FlowLayout"> I load a user control on form, all the textboxes position like they are in grid layout I cannot drag them. What am...
1
by: dale zhang | last post by:
Hi, I have a web form page. it has gridlayout and a table at top like a template. When I have the literal or requiredfieldvalidator ErrorMsg displayed, they are all over the page. Is there...
5
by: JezB | last post by:
There are a few references on the net about how to restore a page's scroll position over a postback. This is a simple one which works for me: eg....
1
by: Leo | last post by:
I created a user control which is some text contained in a HtmlTable. I put this control into main form. I would like to have the ability to move this control around in the main form. I think one...
2
by: Paul E Collins | last post by:
I'm writing an application whose main window consists of a particular UserControl that I have placed inside a docked Panel so that it will fill the whole window. The panel also has the AutoScroll...
1
by: Simon Verona | last post by:
I have a usercontrol which when entered pops up a form. I want the form to be aligned with the bottom edge of the user control. I was doing this by passing the usercontrol into the form as a...
1
by: jobs | last post by:
I have a simple login page with roughly a 300px x 300px image behind the asp.net login control. I need the login control to land in the middle of the image. I want both the image and the login...
0
by: nagarjunt | last post by:
Hi, This is nag. I have a problem with infragistics7.1 UltraTextEditor control. I am using C# code in windows form. I have UltraTextEditor control(With multi line enabled) in my Windows...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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,...
0
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...
0
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...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.