473,396 Members | 1,760 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Problem in ASP.NET with Visual Web Developer

I recently moved to Visual web developer 2008 and it seems I can't move the GUI controls(Text box,lables etc) where I want them. when i drag the control,example the button,to my page,it display on the upper left corner of my page..i try to move it in the middle of the page..but i cant..how can i solve this problem.
Is there a way to sort out this issue.

Thanks
Apr 14 '09 #1
2 3151
Frinavale
9,735 Expert Mod 8TB
You need to use CSS or the style tag of the element.

There are two ways to do this. You can set the "style" property or you can set the "CssClass" property.

Either way you need to use css to do this.

If you want your controls to appear in the middle of the page, place them in a Panel (which renders in the browser as a <div> tag) and set the style for the panel.

For example, after dragging the panel onto the page you should get the following ASP generated (view the Source instead of Design)

Expand|Select|Wrap|Line Numbers
  1. <asp:Panel id="Panel1" runat="server">
  2.  
  3. </asp:Panel>

You can place your controls inside the Panel (either by dragging them into the panel in Desgin view or placing them there in your code)

Expand|Select|Wrap|Line Numbers
  1. <asp:Panel id="Panel1" runat="server">
  2.     <asp:Label id="prompt" runat="server" Text="Prompt for the text box"></asp:Label>
  3.     <asp:TextBox id="input" runat="server"></asp:TextBox>
  4. </asp:Panel>
By default your Label will appear on the left of the TextBox in the above example.

To get this group to appear at the top of the page in the middle of the browser you will set the following style for the Panel:
Expand|Select|Wrap|Line Numbers
  1. <asp:Panel id="Panel1" runat="server" style="width:50%; margin:0px auto;">
  2.     <asp:Label id="prompt" runat="server" Text="Prompt for the text box"></asp:Label>
  3.     <asp:TextBox id="input" runat="server"></asp:TextBox>
  4. </asp:Panel>
You could define a style for this and use the CssClass property of the Panel instead.

For example (place this in the <head> section of your ASP code):
Expand|Select|Wrap|Line Numbers
  1. <style>
  2.   .myPanelGroupStyle
  3.   {  width:50%;
  4.      margin:0px auto;
  5.   }
  6. </style>
Expand|Select|Wrap|Line Numbers
  1. <asp:Panel id="Panel1" runat="server" CssClass="myPanelGroupStyle">
  2.     <asp:Label id="prompt" runat="server" Text="Prompt for the text box"></asp:Label>
  3.     <asp:TextBox id="input" runat="server"></asp:TextBox>
  4. </asp:Panel>
So, I recommend you familiarize yourself with CSS to learn how to do this according to your design requirements.

-Frinny
Apr 15 '09 #2
Thanks a lot.... this is really helpful... thanks again
Apr 16 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

17
by: Andi Plotsky | last post by:
I am not a .NET developer. I want the Developer's Edition of Visual Studio for use with my Access2000 databases. Does anyone have a clue as to where to find it - my office manager says only .NET...
8
by: Will Chamberlain | last post by:
I came across a rather interesting article this morning and thought I'd share. We all know that Visual Studio is a great IDE, but I think we can all agree that it is adds a dramatic change to how...
5
by: Microsoft | last post by:
Hi, I have Visual Basic .net 2003 (Standard Edition) & SQL Server 2000 Developer Edition. When trying to create a connection in the server explorer from the .net IDE I get a number of problems;...
1
by: Blasting Cap | last post by:
I had a copy of a project that was working in Visual Studio 2003 and Framework 1.1. After a computer crash, I was given VS 2005 and am having more than a little difficulty getting things to open...
5
by: cj | last post by:
I'm getting started writing WEB program in VB2005. I'm been doing windows apps to date. A friend told me to get Visual Web Developer Express Edition. But I have Visual Studio Pro 2005 and it...
2
by: Kevin | last post by:
Hi! The Visual Web Developer is better than Visual Studio 2005 for web development? All the Ajax examples are developed in Visual Web Developer. Thanks
16
by: Bill Nguyen | last post by:
I'm running into a very weird problem regarding subtraction. Subtraction behaves as if it's an addition in the below sub txtJacoCost.Text = Format(mRackc - (mDisc + mJaEc), "0.#####0") ...
3
by: Med | last post by:
Hi, I use Visual C# Express 2005 and Visual Web Developer Express 2005. In my Visual C# Express 2005 Solution, I have following two class library projects: _ DataAccess (Namespace name:...
2
by: Cramer | last post by:
So, what is the relationship between Visual Studio and Visual Web Developer. I find a lot of documentation on MSDN that presents Visual Web Developer as it's own stand-alone product (which I'd...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
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,...
0
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...
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...

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.