473,698 Members | 2,643 Online
Bytes | Software Development & Data Engineering Community
+ 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*******@nospa m.com
Nov 18 '05 #1
3 6439
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*******@nosp am.com> wrote in message
news:eo******** ******@TK2MSFTN GP11.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*******@nospa m.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.m icrosoft.com> wrote in message
news:yS******** ******@cpmsftng xa07.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
1138
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 tabbed to the control (field) and press the F2-key., and has begun clicking to different points in the text or moving through it with the arrow keys on the keyboard.
1
2382
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 i missing I am doing something really dumb please help me. -- cindy mello
1
2942
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 any way to control their locations? Thanks. -dale PS: The html code is below:
5
15968
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. http://www.devhood.com/messages/message_view-2.aspx?thread_id=104625 My question is : can the same thing be done to restore the scroll position of a specific DIV within a page? I have a DIV section which scrolls independently to the page : <div style="vertical-align: top; height:200px;...
1
4762
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 way to do this is to change the style of this control at runtime ("Left:xx px; Top:xx px"). Another way is to move the HtmlTable in the control (i.e. change the style of it). However I couldn't figure out how to let it work. At design time, I...
2
7562
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 property set so that the user can scroll if the inner control is larger than the window. Various dialogue boxes (displayed with Form.ShowDialog(this)) are available for setting properties, etc., and I've noticed that when a dialogue box is...
1
27066
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 parameter and using the left and top properties to find the location on the screen to position the form. However, these are relative to the container (panel/form/tabcontrol etc). How can I best locate or pass the actual screen coordinates of my...
1
5169
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 controlrol to always be in the center of the page. How can I do this? I use position:absolute to get the asp.net login control on top of the image, but then when the IE window size is changed (by the user) the login control does not center. Here's...
0
2813
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 Form. A user can drag and drop a text(Usually from a tree node its name would be appended on drag and drop) in this control. Here user can put cursor any where inside this texteditor control and he can drag and drop text into it. Eg: If text editor...
0
8683
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
8611
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
9170
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9031
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
5867
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
4372
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
4624
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
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 we have to send another system
2
2341
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.