?
Solved

Need Help formatting ASP form

Posted on 2011-03-07
7
Medium Priority
?
198 Views
Last Modified: 2012-06-21
I am just starting out with MS Visual Studio 2010 trying to develop an asp form.  As shown in the code attached, I have 3 text boxes and multiple labels all on a single line.
I want to know how to align the text in the boxes to the RIGHT because they will use numbers.
Also, I included a separate label for each that has one character: *  and I set the property of these as RED. but when I run this code the * are the same color as the rest of the labels.
Any guidance would be helpful.

Thanks, Charlie
<%@ Page Title="Home Page" Language="vb" MasterPageFile="~/Site.Master" AutoEventWireup="false"
    CodeBehind="room_worksheet.aspx.vb" Inherits="room_worksheet._Default" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <h2>
        TESCOR, Inc. Room Worksheet</h2>
    <p>
        <asp:Table ID="Table1" runat="server" Width="897px">
        </asp:Table>
    </p>
    <p>
        <asp:Label ID="Label1" runat="server" Text="Exterior Dimensions: "></asp:Label>
        <asp:TextBox ID="txtExt_Width" runat="server" Width="80px"></asp:TextBox>
        <asp:Label ID="Label2" runat="server" Text="Feet Wide"></asp:Label>
        <asp:Label ID="Label3" runat="server" Text="*"></asp:Label>
        <asp:Label ID="Label4" runat="server" Text=" x "></asp:Label>
        <asp:TextBox ID="txtExt_Depth" runat="server" Width="80px"></asp:TextBox>
        <asp:Label ID="Label5" runat="server" Text="Feet Deep"></asp:Label>
        <asp:Label ID="Label6" runat="server" Text="*"></asp:Label>
        <asp:Label ID="Label7" runat="server" Text=" x "></asp:Label>
        <asp:TextBox ID="txtExt_Height" runat="server" Width="80px"></asp:TextBox>
        <asp:Label ID="Label8" runat="server" Text="Feet High"></asp:Label>
        <asp:Label ID="Label9" runat="server" Text="*"></asp:Label>
    </p>
</asp:Content>

Open in new window

0
Comment
Question by:charlieb01
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 8

Accepted Solution

by:
PagodNaUtak earned 2000 total points
ID: 35064838
try the below code:
<%@ Page Title="Home Page" Language="vb" MasterPageFile="~/Site.Master" AutoEventWireup="false"  
    CodeBehind="room_worksheet.aspx.vb" Inherits="room_worksheet._Default" %>  
  
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">  
</asp:Content>  
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">  
    <h2>  
        TESCOR, Inc. Room Worksheet</h2>  
    <p>  
        <asp:Table ID="Table1" runat="server" Width="897px">  
        </asp:Table>  
    </p>  
    <p>  
        <asp:Label ID="Label1" runat="server" Text="Exterior Dimensions: "></asp:Label>  
        <asp:TextBox ID="txtExt_Width" runat="server" Width="80px" Style="text-align:right;"></asp:TextBox>  
        <asp:Label ID="Label2" runat="server" Text="Feet Wide"></asp:Label>  
        <asp:Label ID="Label3" runat="server" style="color:red;" Text="*"></asp:Label>  
        <asp:Label ID="Label4" runat="server" Text=" x "></asp:Label>  
        <asp:TextBox ID="txtExt_Depth" runat="server" Width="80px"  Style="text-align:right;"></asp:TextBox>  
        <asp:Label ID="Label5" runat="server" Text="Feet Deep"></asp:Label>  
        <asp:Label ID="Label6" runat="server" style="color:red;" Text="*"></asp:Label>  
        <asp:Label ID="Label7" runat="server" Text=" x "></asp:Label>  
        <asp:TextBox ID="txtExt_Height" runat="server" Width="80px"  Style="text-align:right;"></asp:TextBox>  
        <asp:Label ID="Label8" runat="server" Text="Feet High"></asp:Label>  
        <asp:Label ID="Label9" runat="server" style="color:red;" Text="*"></asp:Label>  
    </p>  
</asp:Content>

Open in new window

0
 

Author Comment

by:charlieb01
ID: 35064917
OK, thanks, That worked.
But, before I accept this solution can you tell me if the only way to do this is by hand coding or can this be done by setting properties the way most stuff in Visual Studio is set?
0
 
LVL 8

Expert Comment

by:PagodNaUtak
ID: 35065237
You can change the forecolor of a label by perfroming the code below:

click on the label then right click select properties. On the properties toolbar select forecolor then select your desired color on the list.

But for changing the text alignment is done only in code.




0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 8

Expert Comment

by:PagodNaUtak
ID: 35065253
You can change the forecolor of a label by performing the steps below:


•click on the label then right click select properties. On the properties toolbar select forecolor then select your desired color on the list.



But for changing the text alignment is done only in code.

0
 

Author Comment

by:charlieb01
ID: 35065433
I have tried setting the forecolor property of a label as you describe and it doesn't work. I would expect that following your directions I would see the code change and it does not.
0
 
LVL 8

Expert Comment

by:PagodNaUtak
ID: 35065844
0
 

Author Comment

by:charlieb01
ID: 35068167
I read the article and it says the same thing you described regarding the forecolor property. My only point is, it didn't work like that for me. Changing the forecolor property of a label (even a new on I added as a test) did not change the code nor did it change the output when I ran the page.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question